Changeset 81ddbebda3ff13dcf7539bde3280487f103c8d08
- Timestamp:
- 11/27/02 22:51:30 (6 years ago)
- git-parent:
- Files:
-
- AUTHORS (modified) (1 diff)
- modules/gui/win32/preferences.cpp (modified) (26 diffs)
- modules/gui/win32/preferences.dfm (modified) (2 diffs)
- modules/gui/win32/preferences.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
AUTHORS
r85071f3 r81ddbeb 122 122 C: babal 123 123 D: Win32 network input 124 D: Win32 interface 124 125 S: France 125 126 modules/gui/win32/preferences.cpp
r82b8c86 r81ddbeb 5 5 * 6 6 * Authors: Olivier Teuliere <ipkiss@via.ecp.fr> 7 * Boris Dores <babal@via.ecp.fr> 7 8 * 8 9 * This program is free software; you can redistribute it and/or modify … … 40 41 extern intf_thread_t *p_intfGlobal; 41 42 43 /**************************************************************************** 44 * A THintWindow with a limited width 45 ****************************************************************************/ 46 void __fastcall TNarrowHintWindow::ActivateHint(const Windows::TRect &Rect, 47 const System::AnsiString AHint) 48 { 49 TRect NarrowRect = CalcHintRect ( 300 , AHint , NULL ); 50 NarrowRect.Left = Rect.Left; 51 NarrowRect.Top = Rect.Top; 52 NarrowRect.Right += Rect.Left; 53 NarrowRect.Bottom += Rect.Top; 54 THintWindow::ActivateHint ( NarrowRect , AHint ); 55 } 56 57 58 /**************************************************************************** 59 * Just a wrapper to embed an AnsiString into a TObject 60 ****************************************************************************/ 61 __fastcall TObjectString::TObjectString(char * String) 62 { 63 FString = AnsiString(String); 64 } 65 //--------------------------------------------------------------------------- 66 AnsiString __fastcall TObjectString::String() 67 { 68 return FString; 69 } 70 71 72 /**************************************************************************** 73 * A TCheckListBox that automatically disposes any TObject 74 * associated with the string items 75 ****************************************************************************/ 76 __fastcall TCleanCheckListBox::~TCleanCheckListBox() 77 { 78 for ( int i = 0 ; i < Items->Count ; i++ ) 79 { 80 if ( Items->Objects[i] != NULL ) delete Items->Objects[i]; 81 } 82 } 83 42 84 43 85 /**************************************************************************** 44 86 * Functions to help components creation 45 87 ****************************************************************************/ 46 __fastcall T GroupBoxPref::TGroupBoxPref( TComponent* Owner,47 module_config_t *p_config_arg ) : T GroupBox( Owner )88 __fastcall TPanelPref::TPanelPref( TComponent* Owner, 89 module_config_t *p_config_arg ) : TPanel( Owner ) 48 90 { 49 91 p_config = p_config_arg; 50 Caption = p_config->psz_text; 51 } 52 //--------------------------------------------------------------------------- 53 TCheckListBox * __fastcall TGroupBoxPref::CreateCheckListBox( 92 BevelInner = bvNone; 93 BevelOuter = bvNone; 94 BorderStyle = bsNone; 95 } 96 //--------------------------------------------------------------------------- 97 TCleanCheckListBox * __fastcall TPanelPref::CreateCleanCheckListBox( 54 98 TWinControl *Parent, int Left, int Width, int Top, int Height ) 55 99 { 56 TC heckListBox *CheckListBox = new TCheckListBox( Parent );57 C heckListBox->Parent = Parent;58 C heckListBox->Left = Left;59 C heckListBox->Width = Width;60 C heckListBox->Top = Top;61 C heckListBox->Height = Height;62 return C heckListBox;63 } 64 //--------------------------------------------------------------------------- 65 TButton * __fastcall T GroupBoxPref::CreateButton( TWinControl *Parent,100 TCleanCheckListBox *CleanCheckListBox = new TCleanCheckListBox( Parent ); 101 CleanCheckListBox->Parent = Parent; 102 CleanCheckListBox->Left = Left; 103 CleanCheckListBox->Width = Width; 104 CleanCheckListBox->Top = Top; 105 CleanCheckListBox->Height = Height; 106 return CleanCheckListBox; 107 } 108 //--------------------------------------------------------------------------- 109 TButton * __fastcall TPanelPref::CreateButton( TWinControl *Parent, 66 110 int Left, int Width, int Top, int Height, AnsiString Caption ) 67 111 { … … 76 120 } 77 121 //--------------------------------------------------------------------------- 78 TCheckBox * __fastcall T GroupBoxPref::CreateCheckBox( TWinControl *Parent,122 TCheckBox * __fastcall TPanelPref::CreateCheckBox( TWinControl *Parent, 79 123 int Left, int Width, int Top, int Height, AnsiString Caption ) 80 124 { … … 89 133 } 90 134 //--------------------------------------------------------------------------- 91 TLabel * __fastcall T GroupBoxPref::CreateLabel( TWinControl *Parent,135 TLabel * __fastcall TPanelPref::CreateLabel( TWinControl *Parent, 92 136 int Left, int Width, int Top, int Height, AnsiString Caption, 93 137 bool WordWrap ) … … 104 148 } 105 149 //--------------------------------------------------------------------------- 106 TEdit * __fastcall T GroupBoxPref::CreateEdit( TWinControl *Parent,150 TEdit * __fastcall TPanelPref::CreateEdit( TWinControl *Parent, 107 151 int Left, int Width, int Top, int Height, AnsiString Text ) 108 152 { … … 117 161 } 118 162 //--------------------------------------------------------------------------- 119 TCSpinEdit * __fastcall T GroupBoxPref::CreateSpinEdit( TWinControl *Parent,163 TCSpinEdit * __fastcall TPanelPref::CreateSpinEdit( TWinControl *Parent, 120 164 int Left, int Width, int Top, int Height, 121 165 long Min, long Max, long Value ) … … 133 177 } 134 178 //--------------------------------------------------------------------------- 135 void __fastcall TGroupBoxPref::UpdateChanges() 136 { 137 } 138 139 140 /**************************************************************************** 141 * GroupBox for module management 142 ****************************************************************************/ 143 __fastcall TGroupBoxPlugin::TGroupBoxPlugin( TComponent* Owner, 144 module_config_t *p_config ) : TGroupBoxPref( Owner, p_config ) 145 { 146 /* init checklistbox */ 147 CheckListBox = CreateCheckListBox( this, 16, 164, 24, 160 ); 148 CheckListBox->OnClick = CheckListBoxClick; 149 CheckListBox->OnClickCheck = CheckListBoxClickCheck; 150 151 /* init description label */ 152 LabelDesc = CreateLabel( this, 230, 225, 50, 52, 153 p_config->psz_longtext, true ); 154 155 /* init hint label */ 156 LabelHint = CreateLabel( this, 230, 225, 135, 13, "", false ); 157 179 void __fastcall TPanelPref::UpdateChanges() 180 { 181 } 182 183 #define LIBWIN32_PREFSIZE_VPAD 4 184 #define LIBWIN32_PREFSIZE_HPAD 4 185 #define LIBWIN32_PREFSIZE_LEFT 16 186 #define LIBWIN32_PREFSIZE_EDIT_LEFT (LIBWIN32_PREFSIZE_LEFT+32) 187 #define LIBWIN32_PREFSIZE_WIDTH 375 188 #define LIBWIN32_PREFSIZE_EDIT_WIDTH (LIBWIN32_PREFSIZE_WIDTH-32) 189 #define LIBWIN32_PREFSIZE_BUTTON_WIDTH 150 190 #define LIBWIN32_PREFSIZE_SPINEDIT_WIDTH 100 191 #define LIBWIN32_PREFSIZE_RIGHT (LIBWIN32_PREFSIZE_LEFT+LIBWIN32_PREFSIZE_WIDTH) 192 #define LIBWIN32_PREFSIZE_BUTTON_HEIGHT 25 193 #define LIBWIN32_PREFSIZE_LABEL_HEIGHT 26 194 #define LIBWIN32_PREFSIZE_CHECKLISTBOX_HEIGHT 120 195 #define LIBWIN32_PREFSIZE_EDIT_HEIGHT 21 196 #define LIBWIN32_PREFSIZE_CHECKBOX_HEIGHT 17 197 #define LIBWIN32_PREFSIZE_SPINEDIT_HEIGHT 21 198 199 /**************************************************************************** 200 * Panel for module management 201 ****************************************************************************/ 202 __fastcall TPanelPlugin::TPanelPlugin( TComponent* Owner, 203 module_config_t *p_config ) : TPanelPref( Owner, p_config ) 204 { 158 205 /* init configure button */ 159 ButtonConfig = CreateButton( this, 16, 70, 192, 25, "Configure" ); 206 ButtonConfig = CreateButton( this, 207 LIBWIN32_PREFSIZE_RIGHT - LIBWIN32_PREFSIZE_BUTTON_WIDTH, 208 LIBWIN32_PREFSIZE_BUTTON_WIDTH, 209 LIBWIN32_PREFSIZE_VPAD, 210 LIBWIN32_PREFSIZE_BUTTON_HEIGHT, 211 "Configure..." ); 160 212 ButtonConfig->Enabled = false; 161 213 ButtonConfig->OnClick = ButtonConfigClick; 162 214 163 Height = 233; 215 /* init label */ 216 AnsiString Text = AnsiString(p_config->psz_text) + ":"; 217 Label = CreateLabel( this, 218 LIBWIN32_PREFSIZE_LEFT, 219 LIBWIN32_PREFSIZE_RIGHT - LIBWIN32_PREFSIZE_BUTTON_WIDTH 220 - LIBWIN32_PREFSIZE_HPAD, 221 LIBWIN32_PREFSIZE_VPAD, 222 LIBWIN32_PREFSIZE_LABEL_HEIGHT, 223 Text.c_str(), true ); 224 225 /* vertical alignement */ 226 if ( ButtonConfig->Height > Label->Height ) 227 Label->Top += ( ButtonConfig->Height - Label->Height ) / 2; 228 else 229 ButtonConfig->Top += ( Label->Height - ButtonConfig->Height ) / 2; 230 231 /* init checklistbox */ 232 CleanCheckListBox = CreateCleanCheckListBox( this, 233 LIBWIN32_PREFSIZE_EDIT_LEFT, 234 LIBWIN32_PREFSIZE_EDIT_WIDTH, 235 max ( Label->Top + Label->Height , ButtonConfig->Top 236 + ButtonConfig->Height ) + LIBWIN32_PREFSIZE_VPAD, 237 LIBWIN32_PREFSIZE_CHECKLISTBOX_HEIGHT ); 238 CleanCheckListBox->OnClick = CheckListBoxClick; 239 CleanCheckListBox->OnClickCheck = CheckListBoxClickCheck; 240 CleanCheckListBox->Hint = p_config->psz_longtext; 241 CleanCheckListBox->ShowHint = true; 242 243 /* panel height */ 244 Height = CleanCheckListBox->Top + CleanCheckListBox->Height 245 + LIBWIN32_PREFSIZE_VPAD; 164 246 }; 165 247 //--------------------------------------------------------------------------- 166 void __fastcall T GroupBoxPlugin::CheckListBoxClick( TObject *Sender )248 void __fastcall TPanelPlugin::CheckListBoxClick( TObject *Sender ) 167 249 { 168 250 module_t **pp_parser; … … 171 253 /* check that the click is valid (we are on an item, and the click 172 254 * started on an item */ 173 if( C heckListBox->ItemIndex == -1 )255 if( CleanCheckListBox->ItemIndex == -1 ) 174 256 return; 175 257 176 AnsiString Name = CheckListBox->Items->Strings[CheckListBox->ItemIndex]; 258 AnsiString Name = ((TObjectString*)CleanCheckListBox->Items-> 259 Objects[CleanCheckListBox->ItemIndex])->String().c_str(); 177 260 if( Name == "" ) 178 261 return; … … 188 271 { 189 272 ModuleSelected = (*pp_parser); 190 LabelHint->Caption = (*pp_parser)->psz_longname ?191 (*pp_parser)->psz_longname : "";192 273 ButtonConfig->Enabled = 193 274 (*pp_parser)->i_config_items ? true : false; … … 198 279 } 199 280 //--------------------------------------------------------------------------- 200 void __fastcall T GroupBoxPlugin::CheckListBoxClickCheck( TObject *Sender )281 void __fastcall TPanelPlugin::CheckListBoxClickCheck( TObject *Sender ) 201 282 { 202 283 /* one item maximum must be checked */ 203 if( C heckListBox->Checked[CheckListBox->ItemIndex] )204 { 205 for( int item = 0; item < C heckListBox->Items->Count; item++ )284 if( CleanCheckListBox->Checked[CleanCheckListBox->ItemIndex] ) 285 { 286 for( int item = 0; item < CleanCheckListBox->Items->Count; item++ ) 206 287 { 207 if( item != C heckListBox->ItemIndex )288 if( item != CleanCheckListBox->ItemIndex ) 208 289 { 209 C heckListBox->Checked[item] = false;290 CleanCheckListBox->Checked[item] = false; 210 291 } 211 292 } … … 213 294 } 214 295 //--------------------------------------------------------------------------- 215 void __fastcall T GroupBoxPlugin::ButtonConfigClick( TObject *Sender )296 void __fastcall TPanelPlugin::ButtonConfigClick( TObject *Sender ) 216 297 { 217 298 p_intfGlobal->p_sys->p_window-> … … 219 300 } 220 301 //--------------------------------------------------------------------------- 221 void __fastcall T GroupBoxPlugin::UpdateChanges()302 void __fastcall TPanelPlugin::UpdateChanges() 222 303 { 223 304 AnsiString Name = ""; 224 305 225 306 /* find the selected plugin (if any) */ 226 for( int item = 0; item < C heckListBox->Items->Count; item++ )227 { 228 if( C heckListBox->Checked[item] )307 for( int item = 0; item < CleanCheckListBox->Items->Count; item++ ) 308 { 309 if( CleanCheckListBox->Checked[item] ) 229 310 { 230 Name = CheckListBox->Items->Strings[item]; 311 Name = ((TObjectString*)CleanCheckListBox->Items->Objects[item]) 312 ->String().c_str(); 231 313 break; 232 314 } … … 241 323 242 324 /**************************************************************************** 243 * GroupBoxfor string management244 ****************************************************************************/ 245 __fastcall T GroupBoxString::TGroupBoxString( TComponent* Owner,246 module_config_t *p_config ) : T GroupBoxPref( Owner, p_config )325 * Panel for string management 326 ****************************************************************************/ 327 __fastcall TPanelString::TPanelString( TComponent* Owner, 328 module_config_t *p_config ) : TPanelPref( Owner, p_config ) 247 329 { 248 330 /* init description label */ 249 LabelDesc = CreateLabel( this, 230, 225, 24, 26, 250 p_config->psz_longtext, true ); 331 AnsiString Text = AnsiString ( p_config->psz_text ) + ":"; 332 Label = CreateLabel( this, 333 LIBWIN32_PREFSIZE_LEFT, 334 LIBWIN32_PREFSIZE_WIDTH, 335 LIBWIN32_PREFSIZE_VPAD, 336 LIBWIN32_PREFSIZE_LABEL_HEIGHT, 337 Text.c_str(), true ); 251 338 252 339 /* init edit */ 253 Edit = CreateEdit( this, 16, 164, 24, 21, "" ); 340 Edit = CreateEdit( this, 341 LIBWIN32_PREFSIZE_EDIT_LEFT, 342 LIBWIN32_PREFSIZE_EDIT_WIDTH, 343 LIBWIN32_PREFSIZE_VPAD + Label->Height + LIBWIN32_PREFSIZE_VPAD, 344 LIBWIN32_PREFSIZE_EDIT_HEIGHT, "" ); 254 345 vlc_mutex_lock( p_config->p_lock ); 255 346 Edit->Text = p_config->psz_value ? p_config->psz_value : ""; 256 347 vlc_mutex_unlock( p_config->p_lock ); 257 258 /* vertical alignment */ 259 Height = LabelDesc->Height + 24; 260 LabelDesc->Top = Top + ( Height - LabelDesc->Height ) / 2 + 4; 261 Edit->Top = Top + ( Height - Edit->Height ) / 2 + 4; 348 Edit->Hint = p_config->psz_longtext; 349 Edit->ShowHint = true; 350 351 /* panel height */ 352 Height = LIBWIN32_PREFSIZE_VPAD + Label->Height + LIBWIN32_PREFSIZE_VPAD 353 + Edit->Height + LIBWIN32_PREFSIZE_VPAD; 262 354 }; 263 355 //--------------------------------------------------------------------------- 264 void __fastcall T GroupBoxString::UpdateChanges()356 void __fastcall TPanelString::UpdateChanges() 265 357 { 266 358 /* XXX: Necessary, since c_str() returns only a temporary pointer... */ … … 272 364 273 365 /**************************************************************************** 274 * GroupBoxfor integer management275 ****************************************************************************/ 276 __fastcall T GroupBoxInteger::TGroupBoxInteger( TComponent* Owner,277 module_config_t *p_config ) : T GroupBoxPref( Owner, p_config )366 * Panel for integer management 367 ****************************************************************************/ 368 __fastcall TPanelInteger::TPanelInteger( TComponent* Owner, 369 module_config_t *p_config ) : TPanelPref( Owner, p_config ) 278 370 { 279 371 /* init description label */ 280 LabelDesc = CreateLabel( this, 230, 225, 19, 26, 281 p_config->psz_longtext, true ); 372 AnsiString Text = AnsiString ( p_config->psz_text ) + ":"; 373 Label = CreateLabel( this, 374 LIBWIN32_PREFSIZE_LEFT, 375 LIBWIN32_PREFSIZE_WIDTH - LIBWIN32_PREFSIZE_SPINEDIT_WIDTH 376 - LIBWIN32_PREFSIZE_HPAD, 377 LIBWIN32_PREFSIZE_VPAD, 378 LIBWIN32_PREFSIZE_LABEL_HEIGHT, Text.c_str(), true ); 282 379 283 380 /* init spinedit */ 284 SpinEdit = CreateSpinEdit( this, 16, 164, 24, 21, 285 -1, 100000, p_config->i_value ); 286 287 /* vertical alignment */ 288 Height = LabelDesc->Height + 24; 289 LabelDesc->Top = Top + ( Height - LabelDesc->Height ) / 2 + 4; 290 SpinEdit->Top = Top + ( Height - SpinEdit->Height ) / 2 + 4; 381 SpinEdit = CreateSpinEdit( this, 382 LIBWIN32_PREFSIZE_RIGHT - LIBWIN32_PREFSIZE_SPINEDIT_WIDTH, 383 LIBWIN32_PREFSIZE_SPINEDIT_WIDTH, 384 LIBWIN32_PREFSIZE_VPAD, 385 LIBWIN32_PREFSIZE_SPINEDIT_HEIGHT, 386 -1, 100000, p_config->i_value ); 387 SpinEdit->Hint = p_config->psz_longtext; 388 SpinEdit->ShowHint = true; 389 390 /* vertical alignement and panel height */ 391 if ( SpinEdit->Height > Label->Height ) 392 { 393 Label->Top += ( SpinEdit->Height - Label->Height ) / 2; 394 Height = SpinEdit->Top + SpinEdit->Height + LIBWIN32_PREFSIZE_VPAD; 395 } 396 else 397 { 398 SpinEdit->Top += ( Label->Height - SpinEdit->Height ) / 2; 399 Height = Label->Top + Label->Height + LIBWIN32_PREFSIZE_VPAD; 400 } 291 401 }; 292 402 //--------------------------------------------------------------------------- 293 void __fastcall T GroupBoxInteger::UpdateChanges()403 void __fastcall TPanelInteger::UpdateChanges() 294 404 { 295 405 /* Warning: we're casting from long to int */ … … 299 409 300 410 /**************************************************************************** 301 * GroupBox for boolean management 302 ****************************************************************************/ 303 __fastcall TGroupBoxBool::TGroupBoxBool( TComponent* Owner, 304 module_config_t *p_config ) : TGroupBoxPref( Owner, p_config ) 305 { 306 /* init description label */ 307 LabelDesc = CreateLabel( this, 230, 225, 19, 26, 308 p_config->psz_longtext, true ); 309 411 * Panel for boolean management 412 ****************************************************************************/ 413 __fastcall TPanelBool::TPanelBool( TComponent* Owner, 414 module_config_t *p_config ) : TPanelPref( Owner, p_config ) 415 { 310 416 /* init checkbox */ 311 CheckBox = CreateCheckBox( this, 16, 184, 28, 17, p_config->psz_text ); 417 CheckBox = CreateCheckBox( this, 418 LIBWIN32_PREFSIZE_LEFT, 419 LIBWIN32_PREFSIZE_WIDTH, 420 LIBWIN32_PREFSIZE_VPAD, 421 LIBWIN32_PREFSIZE_CHECKBOX_HEIGHT, p_config->psz_text ); 312 422 CheckBox->Checked = p_config->i_value; 313 314 /* vertical alignment */315 Height = LabelDesc->Height + 24; 316 LabelDesc->Top = Top + ( Height - LabelDesc->Height ) / 2 + 4;317 CheckBox->Top = Top + ( Height - CheckBox->Height ) / 2 + 4;423 CheckBox->Hint = p_config->psz_longtext; 424 CheckBox->ShowHint = true; 425 426 /* panel height */ 427 Height = LIBWIN32_PREFSIZE_VPAD + CheckBox->Height + LIBWIN32_PREFSIZE_VPAD; 318 428 }; 319 429 //--------------------------------------------------------------------------- 320 void __fastcall T GroupBoxBool::UpdateChanges()430 void __fastcall TPanelBool::UpdateChanges() 321 431 { 322 432 p_config->i_value = CheckBox->Checked ? 1 : 0; … … 331 441 { 332 442 Icon = p_intfGlobal->p_sys->p_window->Icon; 443 Application->HintHidePause = 0x1000000; 444 HintWindowClass = __classid ( TNarrowHintWindow ); 445 /* prevent the form from being resized horizontally */ 446 Constraints->MinWidth = Width; 447 Constraints->MaxWidth = Width; 333 448 } 334 449 //--------------------------------------------------------------------------- … … 364 479 TScrollBox *ScrollBox; 365 480 TPanel *Panel; 366 T GroupBoxPlugin *GroupBoxPlugin;367 T GroupBoxString *GroupBoxString;368 T GroupBoxInteger *GroupBoxInteger;369 T GroupBoxBool *GroupBoxBool;481 TPanelPlugin *PanelPlugin; 482 TPanelString *PanelString; 483 TPanelInteger *PanelInteger; 484 TPanelBool *PanelBool; 370 485 371 486 /* Look for the selected module */ … … 414 529 ScrollBox->VertScrollBar->Tracking = true; 415 530 531 /* add a panel as top margin */ 532 ADD_PANEL; 533 416 534 break; 417 535 418 536 case CONFIG_ITEM_MODULE: 419 537 420 /* add new groupbox for the config option */ 421 GroupBoxPlugin = new TGroupBoxPlugin( this, p_item ); 422 GroupBoxPlugin->Parent = ScrollBox; 423 424 /* add panel as separator */ 425 ADD_PANEL; 538 /* add new panel for the config option */ 539 PanelPlugin = new TPanelPlugin( this, p_item ); 540 PanelPlugin->Parent = ScrollBox; 426 541 427 542 /* Look for valid modules */ … … 432 547 if( !strcmp( (*pp_parser)->psz_capability, p_item->psz_type ) ) 433 548 { 434 int item = GroupBoxPlugin->CheckListBox->Items->Add( 435 (*pp_parser)->psz_object_name ); 549 AnsiString ModuleDesc; 550 if ( (*pp_parser)->psz_longname != NULL ) { 551 ModuleDesc = AnsiString((*pp_parser)->psz_longname) + 552 " (" + AnsiString((*pp_parser)->psz_object_name) + 553 ")"; 554 } 555 else 556 ModuleDesc = AnsiString((*pp_parser)->psz_object_name); 557 558 int item = PanelPlugin->CleanCheckListBox->Items->AddObject( 559 ModuleDesc.c_str(), 560 new TObjectString((*pp_parser)->psz_object_name) ); 436 561 437 562 /* check the box if it's the default module */ … … 440 565 if( !strcmp( (*pp_parser)->psz_object_name, Name.c_str()) ) 441 566 { 442 GroupBoxPlugin->CheckListBox->Checked[item] = true;567 PanelPlugin->CleanCheckListBox->Checked[item] = true; 443 568 } 444 569 } … … 451 576 case CONFIG_ITEM_STRING: 452 577 453 /* add new groupbox for the config option */ 454 GroupBoxString = new TGroupBoxString( this, p_item ); 455 GroupBoxString->Parent = ScrollBox; 456 457 /* add panel as separator */ 458 ADD_PANEL; 578 /* add new panel for the config option */ 579 PanelString = new TPanelString( this, p_item ); 580 PanelString->Parent = ScrollBox; 459 581 460 582 break; … … 462 584 case CONFIG_ITEM_INTEGER: 463 585 464 /* add new groupbox for the config option */ 465 GroupBoxInteger = new TGroupBoxInteger( this, p_item ); 466 GroupBoxInteger->Parent = ScrollBox; 467 468 /* add panel as separator */ 469 ADD_PANEL; 586 /* add new panel for the config option */ 587 PanelInteger = new TPanelInteger( this, p_item ); 588 PanelInteger->Parent = ScrollBox; 470 589 471 590 break; … … 473 592 case CONFIG_ITEM_BOOL: 474 593 475 /* add new groupbox for the config option */ 476 GroupBoxBool = new TGroupBoxBool( this, p_item ); 477 GroupBoxBool->Parent = ScrollBox; 478 479 /* add panel as separator */ 480 ADD_PANEL; 594 /* add new panel for the config option */ 595 PanelBool = new TPanelBool( this, p_item ); 596 PanelBool->Parent = ScrollBox; 481 597 482 598 break; … … 487 603 while( p_item->i_type != CONFIG_HINT_END ); 488 604 489 /* Reorder groupboxes inside the tabsheets */605 /* Reorder panels inside the tabsheets */ 490 606 for( i_pages = 0; i_pages < PageControlPref->PageCount; i_pages++ ) 491 607 { 492 608 /* get scrollbox from the tabsheet */ 493 609 ScrollBox = (TScrollBox *)PageControlPref->Pages[i_pages]->Controls[0]; 610 611 /* add a panel as bottom margin */ 612 ADD_PANEL; 494 613 495 614 for( i_ctrl = ScrollBox->ControlCount - 1; i_ctrl >= 0 ; i_ctrl-- ) … … 517 636 { 518 637 TScrollBox *ScrollBox; 519 T GroupBoxPref *GroupBox;638 TPanelPref *Panel; 520 639 int i, j; 521 640 … … 528 647 { 529 648 /* skip the panels */ 530 if( ScrollBox->Controls[j]->InheritsFrom( __classid( T GroupBoxPref ) ) )649 if( ScrollBox->Controls[j]->InheritsFrom( __classid( TPanelPref ) ) ) 531 650 { 532 GroupBox = (TGroupBoxPref *)ScrollBox->Controls[j];533 GroupBox->UpdateChanges();534 SaveValue( GroupBox->p_config );651 Panel = (TPanelPref *)ScrollBox->Controls[j]; 652 Panel->UpdateChanges(); 653 SaveValue( Panel->p_config ); 535 654 } 536 655 } modules/gui/win32/preferences.dfm
r82b8c86 r81ddbeb 1 1 object PreferencesDlg: TPreferencesDlg 2 Left = 309 3 Top = 124 4 Width = 522 5 Height = 582 2 Left = 310 3 Top = 125 4 Width = 458 5 Height = 594 6 Anchors = [akTop, akRight] 6 7 Caption = 'Preferences' 7 8 Color = clBtnFace … … 250 251 Left = 8 251 252 Top = 8 252 Width = 497 253 Height = 497 253 Width = 433 254 Height = 511 255 Anchors = [akLeft, akTop, akRight, akBottom] 256 TabOrder = 0 257 end 258 object ButtonApply: TButton 259 Left = 266 260 Top = 530 261 Width = 82 262 Height = 25 263 Anchors = [akRight, akBottom] 264 Caption = 'Apply' 265 TabOrder = 3 266 OnClick = ButtonApplyClick 267 end 268 object ButtonSave: TButton 269 Left = 359 270 Top = 530 271 Width = 82 272 Height = 25 273 Anchors = [akRight, akBottom] 274 Caption = 'Save' 275 TabOrder = 4 276 OnClick = ButtonSaveClick 277 end 278 object ButtonOK: TButton 279 Left = 81 280 Top = 530 281 Width = 82 282 Height = 25 283 Anchors = [akRight, akBottom] 284 Caption = 'OK' 285 Default = True 254 286 TabOrder = 1 255 end 256 object ButtonApply: TButton 257 Left = 146 258 Top = 520 259 Width = 105 260 Height = 25 261 Caption = 'Apply' 262 TabOrder = 0 263 OnClick = ButtonApplyClick 264 end 265 object ButtonSave: TButton 266 Left = 265 267 Top = 520 268 Width = 105 269 Height = 25 270 Caption = 'Save' 287 OnClick = ButtonOkClick 288 end 289 object ButtonCancel: TButton 290 Left = 174 291 Top = 530 292 Width = 82 293 Height = 25 294 Anchors = [akRight, akBottom] 295 Caption = 'Cancel' 271 296 TabOrder = 2 272 OnClick = ButtonSaveClick273 end274 object ButtonOK: TButton275 Left = 26276 Top = 520277 Width = 105278 Height = 25279 Caption = 'OK'280 TabOrder = 3281 OnClick = ButtonOkClick282 end283 object ButtonCancel: TButton284 Left = 386285 Top = 520286 Width = 105287 Height = 25288 Caption = 'Cancel'289 TabOrder = 4290 297 OnClick = ButtonCancelClick 291 298 end modules/gui/win32/preferences.h
r82b8c86 r81ddbeb 5 5 * 6 6 * Authors: Olivier Teuliere <ipkiss@via.ecp.fr> 7 * Boris Dores <babal@via.ecp.fr> 7 8 * 8 9 * This program is free software; you can redistribute it and/or modify … … 34 35 #include "CSPIN.h" 35 36 //--------------------------------------------------------------------------- 36 class TGroupBoxPref : public TGroupBox 37 /* A TCheckListBox that automatically disposes any TObject 38 associated with the string items */ 39 class TCleanCheckListBox : public TCheckListBox 37 40 { 38 41 public: 39 __fastcall TGroupBoxPref( TComponent* Owner, module_config_t *p_config_arg ); 42 __fastcall TCleanCheckListBox(Classes::TComponent* AOwner) 43 : TCheckListBox( AOwner ) { }; 44 virtual __fastcall ~TCleanCheckListBox(); 45 }; 46 //--------------------------------------------------------------------------- 47 /* A THintWindow with a limited width */ 48 class TNarrowHintWindow : public THintWindow 49 { 50 public: 51 virtual void __fastcall ActivateHint(const Windows::TRect &Rect, 52 const System::AnsiString AHint); 53 }; 54 //--------------------------------------------------------------------------- 55 /* Just a wrapper to embed an AnsiString into a TObject */ 56 class TObjectString : public TObject 57 { 58 private: 59 AnsiString FString; 60 public: 61 __fastcall TObjectString(char * String); 62 AnsiString __fastcall String(); 63 }; 64 //--------------------------------------------------------------------------- 65 class TPanelPref : public TPanel 66 { 67 public: 68 __fastcall TPanelPref( TComponent* Owner, module_config_t *p_config_arg ); 40 69 module_config_t *p_config; 41 70 virtual void __fastcall UpdateChanges(); 42 TC heckListBox * __fastcall CreateCheckListBox( TWinControl *Parent,71 TCleanCheckListBox * __fastcall CreateCleanCheckListBox( TWinControl *Parent, 43 72 int Left, int Width, int Top, int Height ); 44 73 TButton * __fastcall CreateButton( TWinControl *Parent, … … 56 85 }; 57 86 //--------------------------------------------------------------------------- 58 class T GroupBoxPlugin : public TGroupBoxPref87 class TPanelPlugin : public TPanelPref 59 88 { 60 89 public: 61 __fastcall T GroupBoxPlugin( TComponent* Owner, module_config_t *p_config );62 TC heckListBox *CheckListBox;90 __fastcall TPanelPlugin( TComponent* Owner, module_config_t *p_config ); 91 TCleanCheckListBox *CleanCheckListBox; 63 92 TButton *ButtonConfig; 64 TLabel *LabelDesc; 65 TLabel *LabelHint; 93 TLabel *Label; 66 94 module_t *ModuleSelected; 67 95 void __fastcall UpdateChanges(); … … 71 99 }; 72 100 //--------------------------------------------------------------------------- 73 class T GroupBoxString : public TGroupBoxPref101 class TPanelString : public TPanelPref 74 102 { 75 103 public: 76 __fastcall T GroupBoxString( TComponent* Owner, module_config_t *p_config );77 TLabel *Label Desc;104 __fastcall TPanelString( TComponent* Owner, module_config_t *p_config ); 105 TLabel *Label; 78 106 TEdit *Edit; 79 107 void __fastcall UpdateChanges(); 80 108 }; 81 109 //--------------------------------------------------------------------------- 82 class T GroupBoxInteger : public TGroupBoxPref110 class TPanelInteger : public TPanelPref 83 111 { 84 112 public: 85 __fastcall T GroupBoxInteger( TComponent* Owner, module_config_t *p_config );86 TLabel *Label Desc;113 __fastcall TPanelInteger( TComponent* Owner, module_config_t *p_config ); 114 TLabel *Label; 87 115 TCSpinEdit *SpinEdit; 88 116 void __fastcall UpdateChanges(); 89 117 }; 90 118 //--------------------------------------------------------------------------- 91 class T GroupBoxBool : public TGroupBoxPref119 class TPanelBool : public TPanelPref 92 120 { 93 121 public: 94 __fastcall TGroupBoxBool( TComponent* Owner, module_config_t *p_config ); 95 TLabel *LabelDesc; 122 __fastcall TPanelBool( TComponent* Owner, module_config_t *p_config ); 96 123 TCheckBox *CheckBox; 97 124 void __fastcall UpdateChanges();
