mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
Juergen's clear-selection-before-insertion patch. See Bug: 441, Bug: 673, Bug: 702, Bug: 954, and Bug: 1226.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7273 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8aff4a1530
commit
68e8fb6694
@ -1,3 +1,8 @@
|
||||
2003-07-14 Juergen Spitzmueller <j.spitzmueller@gmx.de>
|
||||
|
||||
* bufferview_funcs.[Ch]: introduce function replaceSelection()
|
||||
* text3.C: use it to delete selections in some cases
|
||||
(bugs 441, 673, 702, 954).
|
||||
|
||||
2003-07-14 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
|
@ -414,4 +414,15 @@ void toggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// deletes a selection during an insertion
|
||||
void replaceSelection(LyXText * lt)
|
||||
{
|
||||
if (lt->selection.set()) {
|
||||
lt->update();
|
||||
lt->cutSelection(true, false);
|
||||
lt->update();
|
||||
}
|
||||
}
|
||||
|
||||
}; // namespace bv_funcs
|
||||
|
@ -86,7 +86,8 @@ extern string const currentState(BufferView *);
|
||||
///
|
||||
extern void toggleAndShow(BufferView *, LyXFont const &,
|
||||
bool toggleall = true);
|
||||
|
||||
/// replace selection with insertion
|
||||
extern void replaceSelection(LyXText * lt);
|
||||
}; // namespace bv_funcs
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
2003-07-14 Juergen Spitzmueller <j.spitzmueller@gmx.de>
|
||||
|
||||
* insettext.C: use bufferview_funcs->replaceSelection()
|
||||
to delete selections in some cases (bugs 441, 673, 702, 954).
|
||||
|
||||
2003-07-14 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* insettext.C (draw): use slimmed down rowpainter interface
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "bufferview_funcs.h"
|
||||
#include "CutAndPaste.h"
|
||||
#include "debug.h"
|
||||
#include "dimension.h"
|
||||
@ -71,6 +72,7 @@ using std::pair;
|
||||
using std::for_each;
|
||||
|
||||
using namespace lyx::support;
|
||||
using namespace bv_funcs;
|
||||
|
||||
using lyx::pos_type;
|
||||
using lyx::textclass_type;
|
||||
@ -1151,6 +1153,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & cmd)
|
||||
}
|
||||
}
|
||||
|
||||
replaceSelection(bv->getLyXText());
|
||||
size_t sel_index = 0;
|
||||
string const & arg = cmd.argument;
|
||||
if (isStrUnsignedInt(arg)) {
|
||||
@ -1171,6 +1174,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & cmd)
|
||||
result = DISPATCHED;
|
||||
break;
|
||||
}
|
||||
replaceSelection(bv->getLyXText());
|
||||
text_.breakParagraph(paragraphs, 0);
|
||||
updwhat = CURSOR | FULL;
|
||||
updflag = true;
|
||||
@ -1181,6 +1185,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & cmd)
|
||||
result = DISPATCHED;
|
||||
break;
|
||||
}
|
||||
replaceSelection(bv->getLyXText());
|
||||
text_.breakParagraph(paragraphs, 1);
|
||||
updwhat = CURSOR | FULL;
|
||||
updflag = true;
|
||||
@ -1192,6 +1197,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
}
|
||||
|
||||
replaceSelection(bv->getLyXText());
|
||||
text_.insertInset(new InsetNewline);
|
||||
updwhat = CURSOR | CURSOR_PAR;
|
||||
updflag = true;
|
||||
|
18
src/text3.C
18
src/text3.C
@ -20,6 +20,7 @@
|
||||
#include "debug.h"
|
||||
#include "bufferparams.h"
|
||||
#include "buffer.h"
|
||||
#include "bufferview_funcs.h"
|
||||
#include "ParagraphParameters.h"
|
||||
#include "gettext.h"
|
||||
#include "factory.h"
|
||||
@ -44,6 +45,7 @@
|
||||
#include <clocale>
|
||||
|
||||
using namespace lyx::support;
|
||||
using namespace bv_funcs;
|
||||
|
||||
using std::endl;
|
||||
using std::find;
|
||||
@ -369,6 +371,7 @@ void specialChar(LyXText * lt, BufferView * bv, InsetSpecialChar::Kind kind)
|
||||
{
|
||||
lt->update();
|
||||
InsetSpecialChar * new_inset = new InsetSpecialChar(kind);
|
||||
replaceSelection(lt);
|
||||
if (!bv->insertInset(new_inset))
|
||||
delete new_inset;
|
||||
else
|
||||
@ -723,7 +726,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
if (cursor.pos() <= body)
|
||||
break;
|
||||
|
||||
bv->beforeChange(this);
|
||||
replaceSelection(bv->getLyXText());
|
||||
insertInset(new InsetNewline);
|
||||
update();
|
||||
setCursor(cursor.par(), cursor.pos());
|
||||
@ -833,7 +836,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_BREAKPARAGRAPH:
|
||||
bv->beforeChange(this);
|
||||
replaceSelection(bv->getLyXText());
|
||||
breakParagraph(bv->buffer()->paragraphs, 0);
|
||||
update();
|
||||
selection.cursor = cursor;
|
||||
@ -842,7 +845,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
|
||||
bv->beforeChange(this);
|
||||
replaceSelection(bv->getLyXText());
|
||||
breakParagraph(bv->buffer()->paragraphs, 1);
|
||||
update();
|
||||
selection.cursor = cursor;
|
||||
@ -855,7 +858,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
// indentation and add a "defskip" at the top.
|
||||
// Otherwise, do the same as LFUN_BREAKPARAGRAPH.
|
||||
LyXCursor cur = cursor;
|
||||
bv->beforeChange(this);
|
||||
replaceSelection(bv->getLyXText());
|
||||
if (cur.pos() == 0) {
|
||||
if (cur.par()->params().spaceTop() == VSpace(VSpace::NONE)) {
|
||||
setParagraph(
|
||||
@ -1028,10 +1031,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
|
||||
case LFUN_PASTE: {
|
||||
cmd.message(_("Paste"));
|
||||
// clear the selection
|
||||
bv->toggleSelection();
|
||||
clearSelection();
|
||||
update();
|
||||
replaceSelection(bv->getLyXText());
|
||||
size_t sel_index = 0;
|
||||
string const & arg = cmd.argument;
|
||||
if (isStrUnsignedInt(arg)) {
|
||||
@ -1200,6 +1200,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_QUOTE: {
|
||||
replaceSelection(bv->getLyXText());
|
||||
ParagraphList::iterator pit = cursor.par();
|
||||
lyx::pos_type pos = cursor.pos();
|
||||
char c;
|
||||
@ -1221,6 +1222,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_DATE_INSERT: {
|
||||
replaceSelection(bv->getLyXText());
|
||||
time_t now_time_t = time(NULL);
|
||||
struct tm * now_tm = localtime(&now_time_t);
|
||||
setlocale(LC_TIME, "");
|
||||
|
Loading…
Reference in New Issue
Block a user