Ticket #2389: terminal.diff

File terminal.diff, 4.2 KB (added by scottmc, 11 years ago)

fixed diff file, had to add SetTitleDlg.cpp to the Jamfile

  • TermWindow.cpp

     
    3939#include "TermConst.h"
    4040#include "TermScrollView.h"
    4141#include "TermView.h"
     42#include "SetTitleDlg.h"
    4243
    4344
    4445const static int32 kMaxTabs = 6;
     
    145146    fPrintSettings(NULL),
    146147    fPrefWindow(NULL),
    147148    fFindPanel(NULL),
     149    fSetTitlePanel(NULL),
    148150    fSavedFrame(0, 0, -1, -1),
    149151    fFindString(""),
    150152    fFindForwardMenuItem(NULL),
     
    253255    fFilemenu->AddItem(new BMenuItem("Switch Terminals", new BMessage(MENU_SWITCH_TERM),'G'));
    254256    fFilemenu->AddItem(new BMenuItem("New Terminal" B_UTF8_ELLIPSIS, new BMessage(MENU_NEW_TERM), 'N'));
    255257    fFilemenu->AddItem(new BMenuItem("New Tab", new BMessage(kNewTab), 'T'));
     258    fFilemenu->AddItem(new BMenuItem("Set Title" B_UTF8_ELLIPSIS, new BMessage(MENU_SET_WIN_TITLE), 'R'));
    256259   
    257260    fFilemenu->AddSeparatorItem();
    258261    fFilemenu->AddItem(new BMenuItem("Page Setup" B_UTF8_ELLIPSIS, new BMessage(MENU_PAGE_SETUP)));
     
    357360            break;
    358361        }
    359362       
     363        case MENU_SET_WIN_TITLE:
     364            this->SetTitleRequested();
     365            break; 
     366       
     367        case MSG_SET_TITLE_CLOSED:
     368            fSetTitlePanel = NULL;
     369            break;
     370       
    360371        case MENU_PREF_OPEN:
    361372            if (!fPrefWindow)
    362373                fPrefWindow = new PrefWindow(this);
     
    609620
    610621
    611622void
     623TermWindow::SetTitleRequested (void)
     624{
     625  if (fSetTitlePanel)
     626  {
     627    fSetTitlePanel->Activate ();
     628  }
     629  else
     630  {
     631   
     632    BRect rect(0, 0, 250, 100);
     633    rect.OffsetTo (this->Frame().LeftTop());
     634    rect.OffsetBy (100, 100);
     635    fSetTitlePanel = new SetTitleDlg (rect, this);
     636    fSetTitlePanel->Show();
     637  }
     638 
     639}
     640
     641void
    612642TermWindow::WindowActivated(bool activated)
    613643{
    614644    BWindow::WindowActivated(activated);
  • Jamfile

     
    1818    PrefHandler.cpp
    1919    PrefView.cpp
    2020    PrefWindow.cpp
     21    SetTitleDlg.cpp
    2122    Shell.cpp
    2223    SmartTabView.cpp
    2324    TermApp.cpp
  • TermWindow.h

     
    4444class SmartTabView;
    4545class TermView;
    4646class TermViewContainerView;
     47class SetTitleDlg;
    4748
    4849
    4950class TermWindow : public BWindow {
     
    5556                        const char* title);
    5657            void    SessionChanged();
    5758
     59            void            SetTitleRequested (void);
     60            // this was a private function.
     61            // needs to be changed to public
     62            // so it can be used in the SetTitleDlg window to change the title from the GUI's menu
     63            TermView*       _ActiveTermView() const;
     64
    5865protected:
    5966    virtual void    MessageReceived(BMessage *message);
    6067    virtual void    WindowActivated(bool);
     
    7582    void            _RemoveTab(int32 index);
    7683    TermViewContainerView* _ActiveTermViewContainerView() const;
    7784    TermViewContainerView* _TermViewContainerViewAt(int32 index) const;
    78     TermView*       _ActiveTermView() const;
     85    // this was a private function.
     86    // needs to be changed to public
     87    // so it can be used in the SetTitleDlg window to change the title from the GUI's menu
     88    //TermView*     _ActiveTermView() const;
    7989    TermView*       _TermViewAt(int32 index) const;
    8090    int32           _IndexOfTermView(TermView* termView) const;
    8191    void            _CheckChildren();
     
    99109    BMessage        *fPrintSettings;
    100110    PrefWindow      *fPrefWindow;
    101111    FindWindow      *fFindPanel;
     112    SetTitleDlg     *fSetTitlePanel;
    102113    BRect           fSavedFrame;
    103114    window_look     fSavedLook;
    104115
  • TermConst.h

     
    5050const uint32 MENU_SWITCH_TERM   = 'MSWT';
    5151const uint32 MENU_NEW_TERM      = 'MNTE';
    5252const uint32 MENU_PREF_OPEN     = 'MPre';
     53const uint32 MENU_SET_WIN_TITLE = 'MSTL';
    5354const uint32 MENU_CLEAR_ALL     = 'MCAl';
    5455const uint32 MENU_HELP          = 'Mhlp';
    5556const uint32 MENU_COMMAND_HELP  = 'Mchp';
     
    9192const uint32 MSG_TERMINAL_BUFFER_CHANGED        = 'bufc';
    9293const uint32 MSG_SET_TERMNAL_TITLE              = 'sett';
    9394const uint32 MSG_QUIT_TERMNAL                   = 'qutt';
     95const uint32 MSG_SET_TITLE_CLOSED               = 'mstc';
     96const uint32 MSG_OK_CHANGE_TITLE                = 'okct';
    9497
    9598// Preference Read/Write Keys
    9699const char* const PREF_HALF_FONT_FAMILY = "Half Font Family";