X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLyXView.C;h=561e644f1c499863ab23e2157ca6dd54151734fd;hb=98c966c64594611e469313314abd1e59524adb4a;hp=3b8dac80cd08403517eeb723801ce37c96dcf3f7;hpb=54e7ddb5d9a348ae9cfc60f399e9c0c2658ab4c5;p=lyx.git diff --git a/src/LyXView.C b/src/LyXView.C index 3b8dac80cd..561e644f1c 100644 --- a/src/LyXView.C +++ b/src/LyXView.C @@ -1,9 +1,8 @@ - /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -15,33 +14,36 @@ #pragma implementation #endif -#include -#include - #include "LyXView.h" #include "minibuffer.h" #include "debug.h" #include "intl.h" #include "lyxrc.h" -#include "support/filetools.h" // OnlyFilename() #include "lyxtext.h" #include "buffer.h" -#include "frontends/Dialogs.h" -#include "frontends/Toolbar.h" -#include "frontends/Menubar.h" #include "MenuBackend.h" -#include "lyx_gui_misc.h" // [update,Close,Redraw]AllBufferRelatedDialogs #include "bufferview_funcs.h" // CurrentState() #include "gettext.h" #include "lyxfunc.h" #include "BufferView.h" +#include "lyxtextclasslist.h" + +#include "frontends/Dialogs.h" +#include "frontends/Toolbar.h" +#include "frontends/Timeout.h" +#include "frontends/Menubar.h" + +#include "support/filetools.h" // OnlyFilename() + +#include +#include using std::endl; extern void AutoSave(BufferView *); extern void QuitLyX(); -LyXTextClass::size_type current_layout = 0; +string current_layout; LyXView::LyXView() @@ -51,14 +53,11 @@ LyXView::LyXView() intl = new Intl; + // Give the timeout some default sensible value. + autosave_timeout = new Timeout(5000); + dialogs_ = new Dialogs(this); - // temporary until all dialogs moved into Dialogs. - dialogs_->updateBufferDependent - .connect(SigC::slot(&updateAllVisibleBufferRelatedDialogs)); - dialogs_->hideBufferDependent - .connect(SigC::slot(&CloseAllBufferRelatedDialogs)); Dialogs::redrawGUI.connect(SigC::slot(this, &LyXView::redraw)); - Dialogs::redrawGUI.connect(SigC::slot(&RedrawAllBufferRelatedDialogs)); } @@ -70,11 +69,12 @@ LyXView::~LyXView() delete minibuffer; delete lyxfunc; delete intl; + delete autosave_timeout; delete dialogs_; } -void LyXView::resize() +void LyXView::resize() { view()->resize(); } @@ -99,7 +99,7 @@ Toolbar * LyXView::getToolbar() const } -void LyXView::setLayout(LyXTextClass::size_type layout) +void LyXView::setLayout(string const & layout) { toolbar->setLayout(layout); } @@ -108,7 +108,6 @@ void LyXView::setLayout(LyXTextClass::size_type layout) void LyXView::updateToolbar() { toolbar->update(); - menubar->update(); } @@ -148,13 +147,14 @@ Menubar * LyXView::getMenubar() const } -void LyXView::updateMenubar() +void LyXView::updateMenubar() { if ((!view() || !view()->buffer()) && menubackend.hasMenu("main_nobuffer")) menubar->set("main_nobuffer"); else menubar->set("main"); + menubar->update(); } @@ -177,7 +177,7 @@ void LyXView::AutoSave() void LyXView::resetAutosaveTimer() { if (lyxrc.autosave) - autosave_timeout.restart(); + autosave_timeout->restart(); } @@ -193,22 +193,22 @@ void LyXView::updateLayoutChoice() // document is loaded. if (!view() || !view()->buffer()) { toolbar->clearLayoutList(); - return; + return; } // Update the layout display if (last_textclass != int(buffer()->params.textclass)) { toolbar->updateLayoutList(true); last_textclass = int(buffer()->params.textclass); - current_layout = 0; + current_layout = textclasslist[last_textclass].defaultLayoutName(); } else { toolbar->updateLayoutList(false); } - - LyXTextClass::size_type layout = - bufferview->text->cursor.par()->getLayout(); - if (layout != current_layout){ + string const & layout = + bufferview->getLyXText()->cursor.par()->layout(); + + if (layout != current_layout) { toolbar->setLayout(layout); current_layout = layout; } @@ -220,19 +220,22 @@ void LyXView::updateWindowTitle() { static string last_title = "LyX"; string title = "LyX"; + string icon_title = "LyX"; if (view()->available()) { string const cur_title = buffer()->fileName(); - if (!cur_title.empty()){ + if (!cur_title.empty()) { title += ": " + MakeDisplayPath(cur_title, 30); if (!buffer()->isLyxClean()) title += _(" (Changed)"); if (buffer()->isReadonly()) title += _(" (read only)"); + /* Show only the filename if it's available. */ + icon_title = OnlyFilename(cur_title); } } if (title != last_title) { - setWindowTitle(title); + setWindowTitle(title, icon_title); last_title = title; } } @@ -241,6 +244,4 @@ void LyXView::updateWindowTitle() void LyXView::showState() { message(currentState(view())); - getToolbar()->update(); - menubar->update(); }