[svn] / branches / dev-api-4 / xvidcore / vfw / src / config.c Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/vfw/src/config.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1301, Fri Jan 2 13:18:28 2004 UTC revision 1312, Tue Jan 20 14:11:39 2004 UTC
# Line 1311  Line 1311 
1311      }      }
1312    
1313      if (s->mode == RC_ZONE_WEIGHT) {      if (s->mode == RC_ZONE_WEIGHT) {
1314          sprintf(tmp,"%.2f",(float)s->weight/100);                  sprintf(tmp,"W %.2f",(float)s->weight/100);
1315      }else if (s->mode == RC_ZONE_QUANT) {      }else if (s->mode == RC_ZONE_QUANT) {
1316          sprintf(tmp,"( %.2f )",(float)s->quant/100);                  sprintf(tmp,"Q %.2f",(float)s->quant/100);
1317      }else {      }else {
1318          strcpy(tmp,"EXT");          strcpy(tmp,"EXT");
1319      }      }
# Line 1377  Line 1377 
1377    
1378  void main_upload(HWND hDlg, CONFIG * config)  void main_upload(HWND hDlg, CONFIG * config)
1379  {  {
     int i;  
1380    
1381      SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0);      SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0);
1382          SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0);          SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0);
# Line 1388  Line 1387 
1387          SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE);          SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE);
1388      }      }
1389    
1390      ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES));          zones_update(hDlg, config);}
     for (i=0; i < config->num_zones; i++) {  
         main_insert_zone(GetDlgItem(hDlg,IDC_ZONES), &config->zones[i], i, TRUE);  
     }  
 }  
1391    
1392    
1393  /* downloads data from main dialog */  /* downloads data from main dialog */
# Line 1470  Line 1465 
1465    
1466              const static char_int_t columns[] = {              const static char_int_t columns[] = {
1467                  {"Frame #",     64},                  {"Frame #",     64},
1468                  {"Weight (Q)",  72},                                  {"Weight/Quant",  82},
1469                  {"Modifiers",   120}};                  {"Modifiers",   120}};
1470    
1471              LVCOLUMN lvc;              LVCOLUMN lvc;
# Line 1506  Line 1501 
1501    
1502                   main_download(hDlg, config);                   main_download(hDlg, config);
1503                   if (config->cur_zone >= 0 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) {                   if (config->cur_zone >= 0 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) {
1504                       main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[config->cur_zone], config->cur_zone, FALSE);                                           zones_update(hDlg, config);
1505                   }                   }
1506                   break;                   break;
1507              }              }
# Line 1594  Line 1589 
1589                  config->zones[sel+1].bvop_threshold = 0;                  config->zones[sel+1].bvop_threshold = 0;
1590    
1591                  ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0x00000000, LVIS_SELECTED);                  ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0x00000000, LVIS_SELECTED);
1592                  main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[sel+1], sel+1, TRUE);                                  zones_update(hDlg, config);
1593                  ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel+1, 0xffffffff, LVIS_SELECTED);                  ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel+1, 0xffffffff, LVIS_SELECTED);
1594                  break;                  break;
1595              }              }
# Line 1604  Line 1599 
1599                  int i, sel;                  int i, sel;
1600                  sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED);                  sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED);
1601    
1602                  if (sel == -1) {                                  if (sel == -1 || config->num_zones < 1) {
1603                      MessageBox(hDlg, "Nothing selected", "Warning", 0);                                          /*MessageBox(hDlg, "Nothing selected", "Warning", 0);*/
1604                      break;                      break;
1605                  }                  }
1606    
1607                  for (i=sel; i<config->num_zones-1; i++) {                                  for (i=sel; i<config->num_zones-1; i++)
1608                      config->zones[i] = config->zones[i+1];                      config->zones[i] = config->zones[i+1];
1609                  }  
1610                  config->num_zones--;                  config->num_zones--;
                 ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel);  
1611    
1612                  sel--;                                  zones_update(hDlg, config);
                 if (sel==0 && config->num_zones>1) {  
                     sel=1;  
                 }  
                 ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0xffffffff, LVIS_SELECTED);  
1613                  break;                  break;
1614              }              }
1615    
# Line 1627  Line 1617 
1617                  main_download(hDlg, config);                  main_download(hDlg, config);
1618                  config->cur_zone = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED);                  config->cur_zone = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED);
1619                  if (config->cur_zone != -1 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) {                  if (config->cur_zone != -1 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) {
1620                      main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[config->cur_zone], config->cur_zone, FALSE);                                          zones_update(hDlg, config);
1621                  }                  }
1622                  break;                  break;
1623    
# Line 1769  Line 1759 
1759    
1760          return 1;          return 1;
1761  }  }
1762    
1763    static void
1764    sort_zones(zone_t * zones, int zone_num, int * sel)
1765    {
1766            int i, j;
1767            zone_t tmp;
1768            for (i = 0; i < zone_num; i++) {
1769                    int cur = i;
1770                    int min_f = zones[i].frame;
1771                    for (j = i + 1; j < zone_num; j++) {
1772                            if (zones[j].frame < min_f) {
1773                                    min_f = zones[j].frame;
1774                                    cur = j;
1775                            }
1776                    }
1777                    if (cur != i) {
1778                            tmp = zones[i];
1779                            zones[i] = zones[cur];
1780                            zones[cur] = tmp;
1781                            if (i == *sel) *sel = cur;
1782                            else if (cur == *sel) *sel = i;
1783                    }
1784            }
1785    }
1786    
1787    
1788    static void
1789    zones_update(HWND hDlg, CONFIG * config)
1790    {
1791            int i, sel;
1792    
1793            sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED);
1794    
1795            sort_zones(config->zones, config->num_zones, &sel);
1796    
1797            ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES));
1798    
1799            for (i = 0; i < config->num_zones; i++)
1800                    main_insert_zone(GetDlgItem(hDlg,IDC_ZONES), &config->zones[i], i, TRUE);
1801    
1802            if (sel == -1 && config->num_zones > 0) sel = 0;
1803            if (sel >= config->num_zones) sel = config->num_zones-1;
1804    
1805            config->cur_zone = sel;
1806            ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0xffffffff, LVIS_SELECTED);
1807    }

Legend:
Removed from v.1301  
changed lines
  Added in v.1312

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4