Changeset 2297
- Timestamp:
- 12/30/08 18:57:16 (3 years ago)
- File:
-
- 1 edited
-
trunk/Padre/lib/Padre/Wx/MainWindow.pm (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre/lib/Padre/Wx/MainWindow.pm
r2287 r2297 65 65 }; 66 66 67 # NOTE: Yes this method does get a little large, but that's fine. 68 # It's better to have one bigger method that is easily 69 # understandable rather than scattering tightly-related code 70 # all over the place in unrelated places. 71 # If you feel the need to make this smaller, try to make each 72 # individual step tighter and better abstracted. 67 73 sub new { 68 74 my $class = shift; … … 127 133 $self->{marker} = {}; 128 134 135 # Create the menu bar 136 $self->{menu} = Padre::Wx::Menu->new($self); 137 $self->SetMenuBar( $self->menu->wx ); 138 139 # Create the tool bar 140 $self->SetToolBar( 141 Padre::Wx::ToolBar->new($self) 142 ); 143 $self->GetToolBar->Realize; 144 129 145 # Create the status bar 130 146 $self->{gui}->{statusbar} = Padre::Wx::StatusBar->new($self); 131 132 # create basic window components133 $self->create_main_components;134 147 135 148 $self->create_editor_pane; … … 211 224 sub create_main_components { 212 225 my $self = shift; 213 214 # Create the menu bar215 delete $self->{menu} if defined $self->{menu};216 $self->{menu} = Padre::Wx::Menu->new($self);217 $self->SetMenuBar( $self->menu->wx );218 226 219 227 # Create the tool bar … … 483 491 # Refresh Methods 484 492 493 # The term and method "refresh" is reserved for fast, blocking, 494 # real-time updates to the GUI. Enabling and disabling menu entries, 495 # updating dynamic titles and status bars, and other rapid changes. 485 496 sub refresh { 486 497 my $self = shift; … … 516 527 } 517 528 518 sub change_style {519 my $self = shift;520 my $name = shift;521 522 warn "Style: $name\n";523 Padre::Wx::Editor::data($name);524 foreach my $editor ( $self->pages ) {525 $editor->padre_setup;526 }527 528 return;529 }530 531 sub change_locale {532 my $self = shift;533 my $name = shift;534 535 # Save the locale to the config536 Padre->ide->config->{host}->{locale} = $name;537 538 # Reset the locale539 delete $self->{locale};540 $self->{locale} = Padre::Locale::object();541 542 # Refresh the interface with the new labels543 $self->create_main_components;544 $self->refresh;545 546 # Replace the AUI component captions547 $self->manager->GetPane('sidepane')->Caption( Wx::gettext("Subs") );548 $self->manager->GetPane('bottompane')->Caption( Wx::gettext("Output") );549 550 return;551 }552 553 529 sub refresh_syntaxcheck { 554 530 my $self = shift; 555 531 return if $self->no_refresh; 556 532 return if not $self->menu->view->{show_syntaxcheck}->IsChecked; 557 558 533 Padre::Wx::SyntaxChecker::on_syntax_check_timer( $self, undef, 1 ); 559 560 534 return; 561 535 } … … 581 555 # TODO now on every ui chnage (move of the mouse) 582 556 # we refresh this even though that should not be 583 # necessary 584 # can that be eliminated ? 557 # necessary can that be eliminated ? 585 558 sub refresh_methods { 586 559 my $self = shift; … … 630 603 631 604 ##################################################################### 605 # Interface Rebuilding Methods 606 607 sub change_style { 608 my $self = shift; 609 Padre::Wx::Editor::data($_[0]); 610 foreach my $editor ( $self->pages ) { 611 $editor->padre_setup; 612 } 613 return; 614 } 615 616 sub change_locale { 617 my $self = shift; 618 my $name = shift; 619 620 # Save the locale to the config 621 Padre->ide->config->{host}->{locale} = $name; 622 623 # Reset the locale 624 delete $self->{locale}; 625 $self->{locale} = Padre::Locale::object(); 626 627 # Run the "relocale" process to update the GUI 628 $self->relocale; 629 630 # With language stuff updated, do a full refresh 631 # sweep to clean everything up. 632 $self->refresh; 633 634 return; 635 } 636 637 # The term and method "relocale" is reserved for functionality 638 # intended to run when the application wishes to change locale 639 # (and wishes to do so without restarting). 640 sub relocale { 641 my $self = shift; 642 643 # The menu doesn't support relocale, replace it 644 delete $self->{menu}; 645 $self->{menu} = Padre::Wx::Menu->new($self); 646 $self->SetMenuBar( $self->menu->wx ); 647 648 # The toolbar doesn't support relocale, replace it 649 $self->SetToolBar( 650 Padre::Wx::ToolBar->new($self) 651 ); 652 $self->GetToolBar->Realize; 653 654 # Update window manager captions 655 $self->manager->relocale; 656 657 return; 658 } 659 660 661 662 663 664 ##################################################################### 632 665 # Introspection 633 666 … … 654 687 $editor->BeginUndoAction; 655 688 $editor->EndUndoAction; 656 657 689 658 690 =cut
Note: See TracChangeset
for help on using the changeset viewer.
