mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
My six month cleanup crusade is now paying off: LyX has now multiple windows support!
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15438 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
604962d968
commit
4d3fbc113f
@ -32,6 +32,7 @@ Menuset
|
||||
#
|
||||
|
||||
Menu "file"
|
||||
Item "New Window|W" "window-new"
|
||||
Item "New|N" "buffer-new"
|
||||
Item "New from Template...|m" "buffer-new-template"
|
||||
Item "Open...|O" "file-open"
|
||||
|
@ -362,6 +362,7 @@ void LyXAction::init()
|
||||
{ LFUN_MOUSE_TRIPLE, "", ReadOnly },
|
||||
{ LFUN_PARAGRAPH_MOVE_DOWN, "paragraph-move-down", Noop },
|
||||
{ LFUN_PARAGRAPH_MOVE_UP, "paragraph-move-up", Noop },
|
||||
{ LFUN_WINDOW_NEW, "window-new", NoBuffer },
|
||||
{ LFUN_NOACTION, "", Noop }
|
||||
};
|
||||
|
||||
|
@ -45,6 +45,11 @@ public:
|
||||
data_.clear();
|
||||
}
|
||||
|
||||
bool const empty() const
|
||||
{
|
||||
return data_.empty();
|
||||
}
|
||||
|
||||
void add(T const * thing, int x, int y)
|
||||
{
|
||||
data_[thing] = Point(x, y);
|
||||
|
@ -424,7 +424,7 @@ void GuiWorkArea::resizeEvent(QResizeEvent *)
|
||||
|
||||
void GuiWorkArea::update(int x, int y, int w, int h)
|
||||
{
|
||||
viewport()->update(x, y, w, h);
|
||||
viewport()->repaint(x, y, w, h);
|
||||
}
|
||||
|
||||
|
||||
|
@ -369,6 +369,7 @@ enum kb_action {
|
||||
// 280
|
||||
LFUN_INSET_DISSOLVE, // jspitzm 20060807
|
||||
LFUN_CHANGE_NEXT,
|
||||
LFUN_WINDOW_NEW, // Abdel 20062110
|
||||
|
||||
LFUN_LASTACTION // end of the table
|
||||
};
|
||||
|
@ -491,6 +491,28 @@ int LyX::execBatchCommands(int & argc, char * argv[],
|
||||
|
||||
|
||||
void LyX::restoreGuiSession(vector<string> const & files)
|
||||
{
|
||||
LyXView * view = newLyXView();
|
||||
|
||||
// load files
|
||||
for_each(files.begin(), files.end(),
|
||||
bind(&LyXView::loadLyXFile, view, _1, true));
|
||||
|
||||
// if a file is specified, I assume that user wants to edit *that* file
|
||||
if (files.empty() && lyxrc.load_session) {
|
||||
vector<string> const & lastopened = pimpl_->session_->lastOpenedFiles();
|
||||
// do not add to the lastfile list since these files are restored from
|
||||
// last seesion, and should be already there (regular files), or should
|
||||
// not be added at all (help files).
|
||||
for_each(lastopened.begin(), lastopened.end(),
|
||||
bind(&LyXView::loadLyXFile, view, _1, false));
|
||||
}
|
||||
// clear this list to save a few bytes of RAM
|
||||
pimpl_->session_->clearLastOpenedFiles();
|
||||
}
|
||||
|
||||
|
||||
LyXView * LyX::newLyXView()
|
||||
{
|
||||
// determine windows size and position, from lyxrc and/or session
|
||||
// initial geometry
|
||||
@ -513,6 +535,7 @@ void LyX::restoreGuiSession(vector<string> const & files)
|
||||
if (session().loadSessionInfo("WindowIsMaximized") == "yes")
|
||||
maximize = true;
|
||||
}
|
||||
|
||||
// if user wants to restore window position
|
||||
int posx = -1;
|
||||
int posy = -1;
|
||||
@ -533,24 +556,9 @@ void LyX::restoreGuiSession(vector<string> const & files)
|
||||
LyXView * view = &pimpl_->application_->createView(width, height, posx, posy, maximize);
|
||||
ref().addLyXView(view);
|
||||
|
||||
// load files
|
||||
for_each(files.begin(), files.end(),
|
||||
bind(&LyXView::loadLyXFile, view, _1, true));
|
||||
|
||||
// if a file is specified, I assume that user wants to edit *that* file
|
||||
if (files.empty() && lyxrc.load_session) {
|
||||
vector<string> const & lastopened = pimpl_->session_->lastOpenedFiles();
|
||||
// do not add to the lastfile list since these files are restored from
|
||||
// last seesion, and should be already there (regular files), or should
|
||||
// not be added at all (help files).
|
||||
for_each(lastopened.begin(), lastopened.end(),
|
||||
bind(&LyXView::loadLyXFile, view, _1, false));
|
||||
}
|
||||
// clear this list to save a few bytes of RAM
|
||||
pimpl_->session_->clearLastOpenedFiles();
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Signals and Windows
|
||||
===================
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
kb_keymap & topLevelKeymap();
|
||||
kb_keymap const & topLevelKeymap() const;
|
||||
|
||||
void addLyXView(LyXView * lyxview);
|
||||
LyXView * newLyXView();
|
||||
|
||||
/** redraw \c inset in all the BufferViews in which it is currently
|
||||
* visible. If successful return a pointer to the owning Buffer.
|
||||
@ -123,6 +123,9 @@ private:
|
||||
/// Create a View and restore GUI Session.
|
||||
void restoreGuiSession(std::vector<std::string> const & files);
|
||||
|
||||
///
|
||||
void addLyXView(LyXView * lyxview);
|
||||
|
||||
/// Initialize RC font for the GUI.
|
||||
void initGuiFont();
|
||||
|
||||
|
@ -619,6 +619,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
case LFUN_LYXRC_APPLY:
|
||||
case LFUN_BUFFER_NEXT:
|
||||
case LFUN_BUFFER_PREVIOUS:
|
||||
case LFUN_WINDOW_NEW:
|
||||
// these are handled in our dispatch()
|
||||
break;
|
||||
|
||||
@ -1583,6 +1584,10 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_WINDOW_NEW:
|
||||
BOOST_ASSERT(theApp);
|
||||
LyX::ref().newLyXView();
|
||||
|
||||
default: {
|
||||
view()->cursor().dispatch(cmd);
|
||||
updateforce |= view()->cursor().result().update();
|
||||
|
27
src/text2.C
27
src/text2.C
@ -980,10 +980,33 @@ InsetBase * LyXText::editXY(LCursor & cur, int x, int y)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int i=0;
|
||||
InsetBase * inset2 = pars_[pit].getInset(pos - 1);
|
||||
InsetBase * inset3 = pars_[pit].getInset(pos);
|
||||
if (inset != pars_[pit].getInset(pos - 1))
|
||||
{
|
||||
i++;
|
||||
std::cout << "pit " << pit
|
||||
<< " pos -1 " << pos - 1
|
||||
<< "\ninset " << inset
|
||||
<< "\ninset2 " << inset2
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (inset != pars_[pit].getInset(pos))
|
||||
{
|
||||
i++;
|
||||
std::cout << "pit " << pit
|
||||
<< " pos " << pos
|
||||
<< "\ninset " << inset
|
||||
<< "\ninset3 " << inset3
|
||||
<< endl;
|
||||
}
|
||||
if (i == 2)
|
||||
std::cout << endl;
|
||||
|
||||
// This should be just before or just behind the
|
||||
// cursor position set above.
|
||||
InsetBase * inset2 = pars_[pit].getInset(pos - 1);
|
||||
InsetBase * inset3 = pars_[pit].getInset(pos);
|
||||
|
||||
BOOST_ASSERT((pos != 0 && inset == inset2)
|
||||
|| inset == inset3);
|
||||
|
Loading…
Reference in New Issue
Block a user