mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +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"
|
Menu "file"
|
||||||
|
Item "New Window|W" "window-new"
|
||||||
Item "New|N" "buffer-new"
|
Item "New|N" "buffer-new"
|
||||||
Item "New from Template...|m" "buffer-new-template"
|
Item "New from Template...|m" "buffer-new-template"
|
||||||
Item "Open...|O" "file-open"
|
Item "Open...|O" "file-open"
|
||||||
|
@ -362,6 +362,7 @@ void LyXAction::init()
|
|||||||
{ LFUN_MOUSE_TRIPLE, "", ReadOnly },
|
{ LFUN_MOUSE_TRIPLE, "", ReadOnly },
|
||||||
{ LFUN_PARAGRAPH_MOVE_DOWN, "paragraph-move-down", Noop },
|
{ LFUN_PARAGRAPH_MOVE_DOWN, "paragraph-move-down", Noop },
|
||||||
{ LFUN_PARAGRAPH_MOVE_UP, "paragraph-move-up", Noop },
|
{ LFUN_PARAGRAPH_MOVE_UP, "paragraph-move-up", Noop },
|
||||||
|
{ LFUN_WINDOW_NEW, "window-new", NoBuffer },
|
||||||
{ LFUN_NOACTION, "", Noop }
|
{ LFUN_NOACTION, "", Noop }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -45,6 +45,11 @@ public:
|
|||||||
data_.clear();
|
data_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool const empty() const
|
||||||
|
{
|
||||||
|
return data_.empty();
|
||||||
|
}
|
||||||
|
|
||||||
void add(T const * thing, int x, int y)
|
void add(T const * thing, int x, int y)
|
||||||
{
|
{
|
||||||
data_[thing] = Point(x, 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)
|
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
|
// 280
|
||||||
LFUN_INSET_DISSOLVE, // jspitzm 20060807
|
LFUN_INSET_DISSOLVE, // jspitzm 20060807
|
||||||
LFUN_CHANGE_NEXT,
|
LFUN_CHANGE_NEXT,
|
||||||
|
LFUN_WINDOW_NEW, // Abdel 20062110
|
||||||
|
|
||||||
LFUN_LASTACTION // end of the table
|
LFUN_LASTACTION // end of the table
|
||||||
};
|
};
|
||||||
|
@ -491,6 +491,28 @@ int LyX::execBatchCommands(int & argc, char * argv[],
|
|||||||
|
|
||||||
|
|
||||||
void LyX::restoreGuiSession(vector<string> const & files)
|
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
|
// determine windows size and position, from lyxrc and/or session
|
||||||
// initial geometry
|
// initial geometry
|
||||||
@ -513,6 +535,7 @@ void LyX::restoreGuiSession(vector<string> const & files)
|
|||||||
if (session().loadSessionInfo("WindowIsMaximized") == "yes")
|
if (session().loadSessionInfo("WindowIsMaximized") == "yes")
|
||||||
maximize = true;
|
maximize = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if user wants to restore window position
|
// if user wants to restore window position
|
||||||
int posx = -1;
|
int posx = -1;
|
||||||
int posy = -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);
|
LyXView * view = &pimpl_->application_->createView(width, height, posx, posy, maximize);
|
||||||
ref().addLyXView(view);
|
ref().addLyXView(view);
|
||||||
|
|
||||||
// load files
|
return view;
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Signals and Windows
|
Signals and Windows
|
||||||
===================
|
===================
|
||||||
|
@ -93,7 +93,7 @@ public:
|
|||||||
kb_keymap & topLevelKeymap();
|
kb_keymap & topLevelKeymap();
|
||||||
kb_keymap const & topLevelKeymap() const;
|
kb_keymap const & topLevelKeymap() const;
|
||||||
|
|
||||||
void addLyXView(LyXView * lyxview);
|
LyXView * newLyXView();
|
||||||
|
|
||||||
/** redraw \c inset in all the BufferViews in which it is currently
|
/** redraw \c inset in all the BufferViews in which it is currently
|
||||||
* visible. If successful return a pointer to the owning Buffer.
|
* visible. If successful return a pointer to the owning Buffer.
|
||||||
@ -123,6 +123,9 @@ private:
|
|||||||
/// Create a View and restore GUI Session.
|
/// Create a View and restore GUI Session.
|
||||||
void restoreGuiSession(std::vector<std::string> const & files);
|
void restoreGuiSession(std::vector<std::string> const & files);
|
||||||
|
|
||||||
|
///
|
||||||
|
void addLyXView(LyXView * lyxview);
|
||||||
|
|
||||||
/// Initialize RC font for the GUI.
|
/// Initialize RC font for the GUI.
|
||||||
void initGuiFont();
|
void initGuiFont();
|
||||||
|
|
||||||
|
@ -619,6 +619,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
|||||||
case LFUN_LYXRC_APPLY:
|
case LFUN_LYXRC_APPLY:
|
||||||
case LFUN_BUFFER_NEXT:
|
case LFUN_BUFFER_NEXT:
|
||||||
case LFUN_BUFFER_PREVIOUS:
|
case LFUN_BUFFER_PREVIOUS:
|
||||||
|
case LFUN_WINDOW_NEW:
|
||||||
// these are handled in our dispatch()
|
// these are handled in our dispatch()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1583,6 +1584,10 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case LFUN_WINDOW_NEW:
|
||||||
|
BOOST_ASSERT(theApp);
|
||||||
|
LyX::ref().newLyXView();
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
view()->cursor().dispatch(cmd);
|
view()->cursor().dispatch(cmd);
|
||||||
updateforce |= view()->cursor().result().update();
|
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;
|
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
|
// This should be just before or just behind the
|
||||||
// cursor position set above.
|
// cursor position set above.
|
||||||
InsetBase * inset2 = pars_[pit].getInset(pos - 1);
|
|
||||||
InsetBase * inset3 = pars_[pit].getInset(pos);
|
|
||||||
|
|
||||||
BOOST_ASSERT((pos != 0 && inset == inset2)
|
BOOST_ASSERT((pos != 0 && inset == inset2)
|
||||||
|| inset == inset3);
|
|| inset == inset3);
|
||||||
|
Loading…
Reference in New Issue
Block a user