Ticket #199: 199-1.patch
File 199-1.patch, 8.6 KB (added by , 18 years ago) |
---|
-
src/apps/terminal/TermWindow.cpp
27 27 #include "CodeConv.h" 28 28 #include "ColorWindow.h" 29 29 #include "MenuUtil.h" 30 #include "FindDlg.h" 30 31 #include "PrefDlg.h" 31 32 #include "PrefView.h" 32 33 #include "PrefHandler.h" … … 219 220 fEditmenu->AddSeparatorItem (); 220 221 fEditmenu->AddItem (new BMenuItem ("Select All", new BMessage (B_SELECT_ALL), 'A')); 221 222 fEditmenu->AddItem (new BMenuItem ("Clear All", new BMessage (MENU_CLEAR_ALL), 'L')); 223 fEditmenu->AddSeparatorItem (); 224 fEditmenu->AddItem (new BMenuItem ("Find", new BMessage (MENU_FIND_STRING),'F')); 225 fEditmenu->AddItem (new BMenuItem ("Find Again", new BMessage (MENU_FIND_AGAIN), ']')); 222 226 223 /*224 // TODO: Implement Finding225 fEditmenu->AddSeparatorItem ();226 fEditmenu->AddItem (new BMenuItem ("Find", new BMessage (MENU_FIND_STRING),'F'));227 fEditmenu->AddItem (new BMenuItem ("Find Again", new BMessage (MENU_FIND_AGAIN), ']'));228 */229 227 fMenubar->AddItem (fEditmenu); 230 228 231 229 // Make Help Menu. … … 303 301 fPrefWindow = NULL; 304 302 break; 305 303 } 304 case MENU_FIND_STRING: { 305 if (!fFindPanel) { 306 BRect r = Frame(); 307 r.left += 20; 308 r.top += 20; 309 r.right = r.left + 260; 310 r.bottom = r.top + 220; 311 fFindPanel = new FindDlg(r, this); 312 } 313 else 314 fFindPanel->Activate(); 315 break; 316 } 317 case MSG_FIND_CLOSED: { 318 fFindPanel = NULL; 319 break; 320 } 306 321 case MENU_FILE_QUIT: { 307 322 be_app->PostMessage(B_QUIT_REQUESTED); 308 323 break; … … 523 538 delete fTermParse; 524 539 delete fCodeConv; 525 540 if(fPrefWindow) fPrefWindow->PostMessage (B_QUIT_REQUESTED); 526 be_app->PostMessage (B_QUIT_REQUESTED, be_app); 541 if(fFindPanel) fFindPanel->PostMessage(B_QUIT_REQUESTED); 542 543 be_app->PostMessage (B_QUIT_REQUESTED, be_app); 527 544 BWindow::Quit (); 528 545 } 529 546 -
src/apps/terminal/Changelog
13 13 Terminal window supports scrolling 14 14 15 15 TODO: 16 Make a Jamfile17 16 Make Find work 18 17 Fix titling (-t works already, its the Terminal 1, 2, 3, etc...) 19 18 Fix the Colour menu 20 19 Move Fonts and font sizes to the "Right Place" 21 20 Kill the Preferences Panel 22 Move to .rdef source resources -
src/apps/terminal/FindDlg.h
36 36 #include "CurPos.h" 37 37 38 38 const ulong MSG_FIND_START = 'msac'; 39 const ulong MSG_FIND_CLOSED = 'mfcl'; 39 40 40 41 class BRect; 41 42 class BBitmap; 42 43 class BMessage; 43 44 class TermWindow; 45 class BTextControl; 46 class BRadioButton; 47 class BCheckBox; 44 48 45 49 class FindDlg : public BWindow 46 50 { 47 51 public: 48 49 52 FindDlg(BRect frame, TermWindow *win); 53 ~FindDlg (); 50 54 51 55 void Find (CurPos *start, CurPos *end); 52 56 53 private: 54 virtual void Quit (void); 55 56 BString *fFindString; 57 TermWindow *fWindow; 57 private: 58 virtual void Quit (void); 58 59 60 BView *fFindView; 61 BTextControl *fFindLabel; 62 BRadioButton *fTextRadio; 63 BRadioButton *fSelectionRadio; 64 BBox *fSeparator; 65 BCheckBox *fForwardSearchBox; 66 BCheckBox *fMatchCaseBox; 67 BCheckBox *fMatchWordBox; 68 BCheckBox *fRegexpBox; 69 BButton *fFindButton; 70 71 BString *fFindString; 72 TermWindow *fWindow; 59 73 }; 60 74 61 75 -
src/apps/terminal/Jamfile
7 7 AppearPrefView.cpp 8 8 CodeConv.cpp 9 9 CurPos.cpp 10 FindDlg.cpp 10 11 MenuUtil.cpp 11 12 Terminal.cpp 12 13 PrefDlg.cpp -
src/apps/terminal/FindDlg.cpp
31 31 #include <Window.h> 32 32 #include <Rect.h> 33 33 #include <TextControl.h> 34 #include <Box.h> 35 #include <CheckBox.h> 34 36 #include <Button.h> 37 #include <RadioButton.h> 35 38 #include <Message.h> 36 39 #include <stdio.h> 37 40 #include <File.h> 38 41 #include <String.h> 39 42 43 #include "TermWindow.h" 40 44 #include "FindDlg.h" 41 45 #include "TermApp.h" 42 46 #include "MenuUtil.h" … … 51 55 // Constructer 52 56 ////////////////////////////////////////////////////////////////////////////// 53 57 FindDlg::FindDlg (BRect frame, TermWindow *win) 54 55 58 : BWindow(frame, "Find", 59 B_FLOATING_WINDOW, B_NOT_RESIZABLE|B_NOT_ZOOMABLE) 56 60 { 57 PrefHandler title;58 LoadLocaleFile (&title);61 fWindow = win; 62 SetTitle("Find"); 59 63 60 fWindow = win;61 this->SetTitle (title.getString ("Find"));64 AddShortcut ((ulong)'Q', (ulong)B_COMMAND_KEY, new BMessage (FPANEL_HIDE)); 65 AddShortcut ((ulong)'W', (ulong)B_COMMAND_KEY, new BMessage (FPANEL_HIDE)); 62 66 63 AddShortcut ((ulong)'Q', (ulong)B_COMMAND_KEY, new BMessage (FPANEL_HIDE)); 64 AddShortcut ((ulong)'W', (ulong)B_COMMAND_KEY, new BMessage (FPANEL_HIDE)); 67 //Build up view 68 fFindView = new BView(Bounds(), "FindView", B_FOLLOW_ALL, B_WILL_DRAW); 69 fFindView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 70 AddChild(fFindView); 65 71 66 BRect r (10, 10, 120, 20); 67 68 BTextControl *text_ctl = new BTextControl (r, "text", NULL, NULL, NULL); 69 AddChild (text_ctl); 72 font_height height; 73 fFindView->GetFontHeight(&height); 74 float lineHeight = height.ascent + height.descent + height.leading; 70 75 71 r.Set (100, 40, 130, 60); 72 BButton *button = new BButton (r, NULL, "Find", new BMessage (MSG_FIND_START)); 73 AddChild (button); 74 76 //These labels are from the bottom up 77 float buttonsTop = frame.Height() - 19 - lineHeight; 78 float regexpBottom = buttonsTop - 4; 79 float regexpTop = regexpBottom - lineHeight - 8; 80 float matchwordBottom = regexpTop - 4; 81 float matchwordTop = matchwordBottom - lineHeight - 8; 82 float matchcaseBottom = matchwordTop - 4; 83 float matchcaseTop = matchcaseBottom - lineHeight - 8; 84 float forwardsearchBottom = matchcaseTop - 4; 85 float forwardsearchTop = forwardsearchBottom - lineHeight - 10; 86 87 //These things are calculated from the top 88 float textRadioTop = 12; 89 float textRadioBottom = textRadioTop + 2 + lineHeight + 2 + 1; 90 float textRadioRight = fFindView->StringWidth("Use Text: ") + 30; 91 float selectionRadioTop = textRadioBottom + 4; 92 float selectionRadioBottom = selectionRadioTop + lineHeight + 8; 93 94 //Divider 95 float dividerHeight = (selectionRadioBottom + forwardsearchTop) / 2; 96 97 //Button Coordinates 98 float searchbuttonLeft = (frame.Width() - fFindView->StringWidth("Find") - 60) / 2; 99 float searchbuttonRight = searchbuttonLeft + fFindView->StringWidth("Find") + 60; 100 101 //Build the Views 102 fTextRadio = new BRadioButton(BRect(14, textRadioTop, textRadioRight, textRadioBottom), 103 "fTextRadio", "Use Text: ", NULL); 104 fFindView->AddChild(fTextRadio); 105 106 fFindLabel = new BTextControl(BRect(textRadioRight + 4, textRadioTop, frame.Width() - 14, textRadioBottom), 107 "fFindLabel", "", "", NULL); 108 fFindLabel->SetDivider(0); 109 fFindView->AddChild(fFindLabel); 110 111 fTextRadio->SetValue(1); //enable first option 112 113 fSelectionRadio = new BRadioButton(BRect(14, selectionRadioTop, frame.Width() - 14, selectionRadioBottom), 114 "fSelectionRadio", "Use Selection", NULL); 115 fFindView->AddChild(fSelectionRadio); 116 117 fSeparator = new BBox(BRect(6, dividerHeight, frame.Width() - 6, dividerHeight + 1)); 118 fFindView->AddChild(fSeparator); 119 120 fForwardSearchBox = new BCheckBox(BRect(14, forwardsearchTop, frame.Width() - 14, forwardsearchBottom), 121 "fForwardSearchBox", "Search Forward", NULL); 122 fFindView->AddChild(fForwardSearchBox); 123 124 fMatchCaseBox = new BCheckBox(BRect(14, matchcaseTop, frame.Width() - 14, matchcaseBottom), 125 "fMatchCaseBox", "Match Case", NULL); 126 fFindView->AddChild(fMatchCaseBox); 127 128 fMatchWordBox = new BCheckBox(BRect(14, matchwordTop, frame.Width() - 14, matchwordBottom), 129 "fMatchWordBox", "Match Word", NULL); 130 fFindView->AddChild(fMatchWordBox); 131 132 fRegexpBox = new BCheckBox(BRect(14, regexpTop, frame.Width() - 14, regexpBottom), 133 "fRegexpBox", "Use Regular Expression", NULL); 134 fFindView->AddChild(fRegexpBox); 135 136 fFindButton = new BButton(BRect(searchbuttonLeft, buttonsTop, searchbuttonRight, frame.Height() - 14), 137 "fFindButton", "Find", NULL); 138 fFindButton->MakeDefault(true); 139 fFindView->AddChild(fFindButton); 140 141 Show(); 75 142 } 76 143 77 144 FindDlg::~FindDlg (void) … … 82 149 void 83 150 FindDlg::Quit (void) 84 151 { 85 BWindow::Quit (); 152 fWindow->PostMessage(MSG_FIND_CLOSED); 153 BWindow::Quit (); 86 154 } 87 155