diff --git a/src/apps/webpositive/BrowserWindow.cpp b/src/apps/webpositive/BrowserWindow.cpp index 07a5f62087..399c258611 100644 --- a/src/apps/webpositive/BrowserWindow.cpp +++ b/src/apps/webpositive/BrowserWindow.cpp @@ -82,9 +82,10 @@ enum { CREATE_BOOKMARK = 'crbm', SHOW_BOOKMARKS = 'shbm', - TEXT_SIZE_INCREASE = 'tsin', - TEXT_SIZE_DECREASE = 'tsdc', - TEXT_SIZE_RESET = 'tsrs', + ZOOM_FACTOR_INCREASE = 'zfin', + ZOOM_FACTOR_DECREASE = 'zfdc', + ZOOM_FACTOR_RESET = 'zfrs', + ZOOM_TEXT_ONLY = 'zfto', TEXT_SHOW_FIND_GROUP = 'sfnd', TEXT_HIDE_FIND_GROUP = 'hfnd', @@ -243,7 +244,8 @@ BrowserWindow::BrowserWindow(BRect frame, ToolbarPolicy toolbarPolicy, : BWebWindow(frame, kApplicationName, B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, - B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS) + B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS), + fZoomTextOnly(true) { BMessage* newTabMessage = new BMessage(NEW_TAB); newTabMessage->AddString("url", ""); @@ -282,9 +284,13 @@ BrowserWindow::BrowserWindow(BRect frame, ToolbarPolicy toolbarPolicy, menu = new BMenu("Text"); menu->AddItem(new BMenuItem("Find", new BMessage(TEXT_SHOW_FIND_GROUP), 'F')); menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem("Increase size", new BMessage(TEXT_SIZE_INCREASE), '+')); - menu->AddItem(new BMenuItem("Decrease size", new BMessage(TEXT_SIZE_DECREASE), '-')); - menu->AddItem(new BMenuItem("Reset size", new BMessage(TEXT_SIZE_RESET), '0')); + menu->AddItem(new BMenuItem("Increase size", new BMessage(ZOOM_FACTOR_INCREASE), '+')); + menu->AddItem(new BMenuItem("Decrease size", new BMessage(ZOOM_FACTOR_DECREASE), '-')); + menu->AddItem(new BMenuItem("Reset size", new BMessage(ZOOM_FACTOR_RESET), '0')); + fZoomTextOnlyMenuItem = new BMenuItem("Zoom text only", + new BMessage(ZOOM_TEXT_ONLY)); + fZoomTextOnlyMenuItem->SetMarked(fZoomTextOnly); + menu->AddItem(fZoomTextOnlyMenuItem); mainMenu->AddItem(menu); fGoMenu = new BMenu("Go"); @@ -593,14 +599,20 @@ printf(" file ok\n"); break; } - case TEXT_SIZE_INCREASE: - CurrentWebView()->IncreaseTextSize(); + case ZOOM_FACTOR_INCREASE: + CurrentWebView()->IncreaseZoomFactor(fZoomTextOnly); break; - case TEXT_SIZE_DECREASE: - CurrentWebView()->DecreaseTextSize(); + case ZOOM_FACTOR_DECREASE: + CurrentWebView()->DecreaseZoomFactor(fZoomTextOnly); break; - case TEXT_SIZE_RESET: - CurrentWebView()->ResetTextSize(); + case ZOOM_FACTOR_RESET: + CurrentWebView()->ResetZoomFactor(); + break; + case ZOOM_TEXT_ONLY: + fZoomTextOnly = !fZoomTextOnly; + fZoomTextOnlyMenuItem->SetMarked(fZoomTextOnly); + // TODO: Would be nice to have an instant update if the page is already + // zoomed. break; case TEXT_FIND_NEXT: diff --git a/src/apps/webpositive/BrowserWindow.h b/src/apps/webpositive/BrowserWindow.h index 9d552f9b4d..e1ec942b2e 100644 --- a/src/apps/webpositive/BrowserWindow.h +++ b/src/apps/webpositive/BrowserWindow.h @@ -40,6 +40,7 @@ class BDirectory; class BFile; class BLayoutItem; class BMenu; +class BMenuItem; class BPath; class BStatusBar; class BStringView; @@ -142,6 +143,8 @@ private: private: BMenu* fGoMenu; + BMenuItem* fZoomTextOnlyMenuItem; + bool fZoomTextOnly; IconButton* fBackButton; IconButton* fForwardButton; IconButton* fStopButton;