TermView doesn't know about PrefHandler anymore (again), so that, in case
it's used as replicant (but I think it won't work anymore, yet), it doesn't influence the global settings. TermWindow saves the preferences on quit, if the PrefWindow was never instantiated. This allows the window size to be saved also when it's resized manually (not via menu). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34165 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
bf00b7798c
commit
17ecdb5b2f
@ -47,7 +47,6 @@
|
||||
|
||||
#include "CodeConv.h"
|
||||
#include "Globals.h"
|
||||
#include "PrefHandler.h"
|
||||
#include "Shell.h"
|
||||
#include "TermConst.h"
|
||||
#include "TerminalCharClassifier.h"
|
||||
@ -469,6 +468,20 @@ TermView::GetFontSize(int* _width, int* _height)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
TermView::Rows() const
|
||||
{
|
||||
return fRows;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
TermView::Columns() const
|
||||
{
|
||||
return fColumns;
|
||||
}
|
||||
|
||||
|
||||
//! Set number of rows and columns in terminal
|
||||
BRect
|
||||
TermView::SetTermSize(int rows, int columns, bool resize)
|
||||
@ -479,9 +492,6 @@ TermView::SetTermSize(int rows, int columns, bool resize)
|
||||
if (columns > 0)
|
||||
fColumns = columns;
|
||||
|
||||
PrefHandler::Default()->setInt32(PREF_COLS, fColumns);
|
||||
PrefHandler::Default()->setInt32(PREF_ROWS, fRows);
|
||||
|
||||
// To keep things simple, get rid of the selection first.
|
||||
_Deselect();
|
||||
|
||||
|
@ -51,6 +51,8 @@ public:
|
||||
void SetTermFont(const BFont* font);
|
||||
|
||||
void GetFontSize(int* width, int* height);
|
||||
int Rows() const;
|
||||
int Columns() const;
|
||||
BRect SetTermSize(int rows, int cols, bool resize);
|
||||
|
||||
void SetTextColor(rgb_color fore, rgb_color back);
|
||||
|
@ -162,9 +162,17 @@ TermWindow::TermWindow(BRect frame, const char* title, Arguments *args)
|
||||
|
||||
TermWindow::~TermWindow()
|
||||
{
|
||||
// If there's no prefwindow, save the preferences by ourselves.
|
||||
// For example, this saves the columns/rows number.
|
||||
// TODO: Code duplication. Exterminate
|
||||
if (fPrefWindow)
|
||||
fPrefWindow->PostMessage(B_QUIT_REQUESTED);
|
||||
|
||||
else {
|
||||
BPath path;
|
||||
if (PrefHandler::GetDefaultPath(path) == B_OK)
|
||||
PrefHandler::Default()->SaveAsText(path.Path(), PREFFILE_MIMETYPE);
|
||||
}
|
||||
|
||||
if (fFindPanel && fFindPanel->Lock()) {
|
||||
fFindPanel->Quit();
|
||||
fFindPanel = NULL;
|
||||
@ -902,6 +910,17 @@ TermWindow::Zoom(BPoint leftTop, float width, float height)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermWindow::FrameResized(float newWidth, float newHeight)
|
||||
{
|
||||
BWindow::FrameResized(newWidth, newHeight);
|
||||
|
||||
TermView *view = _ActiveTermView();
|
||||
PrefHandler::Default()->setInt32(PREF_COLS, view->Columns());
|
||||
PrefHandler::Default()->setInt32(PREF_ROWS, view->Rows());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermWindow::_ResizeView(TermView *view)
|
||||
{
|
||||
|
@ -60,6 +60,7 @@ protected:
|
||||
virtual void WindowActivated(bool);
|
||||
virtual void MenusBeginning();
|
||||
virtual void Zoom(BPoint leftTop, float width, float height);
|
||||
virtual void FrameResized(float newWidth, float newHeight);
|
||||
|
||||
private:
|
||||
struct Session;
|
||||
|
Loading…
Reference in New Issue
Block a user