27 moved, 19 killed...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5119 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-08-27 13:39:27 +00:00
parent 2a0909f47b
commit 38fd440edb
2 changed files with 25 additions and 44 deletions

View File

@ -65,26 +65,15 @@
#include "support/LAssert.h"
#include "support/lstrings.h"
#include "support/filetools.h"
#include "support/lyxfunctional.h"
#include <boost/bind.hpp>
#include <boost/signals/connection.hpp>
#include <cstdio>
#include <ctime>
#include <unistd.h>
#include <sys/wait.h>
#include <clocale>
#ifndef CXX_GLOBAL_CSTD
using std::tm;
using std::localtime;
using std::time;
using std::setlocale;
using std::strftime;
#endif
using std::vector;
using std::find_if;
using std::find;
@ -94,15 +83,12 @@ using std::make_pair;
using std::min;
using lyx::pos_type;
using lyx::textclass_type;
/* the selection possible is needed, that only motion events are
* used, where the bottom press event was on the drawing area too */
bool selection_possible = false;
extern BufferList bufferlist;
extern char ascii_type;
extern int bibitemMaxWidth(BufferView *, LyXFont const &);
@ -892,7 +878,6 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y)
}
// look at previous position
if (cursor.pos() == 0) {
return 0;
}
@ -1859,35 +1844,6 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev)
}
break;
case LFUN_DATE_INSERT: // jdblair: date-insert cmd
{
time_t now_time_t = time(NULL);
struct tm * now_tm = localtime(&now_time_t);
setlocale(LC_TIME, "");
string arg;
if (!ev.argument.empty())
arg = ev.argument;
else
arg = lyxrc.date_insert_format;
char datetmp[32];
int const datetmp_len =
::strftime(datetmp, 32, arg.c_str(), now_tm);
LyXText * lt = bv_->getLyXText();
for (int i = 0; i < datetmp_len; i++) {
lt->insertChar(bv_, datetmp[i]);
update(lt,
BufferView::SELECT
| BufferView::FITCUR
| BufferView::CHANGE);
}
lt->selection.cursor = lt->cursor;
moveCursorUpdate(false);
}
break;
case LFUN_UNKNOWN_ACTION:
ev.errorMessage(N_("Unknown function!"));
break;

View File

@ -33,6 +33,9 @@
#include "insets/insetcommand.h"
#include "undo_funcs.h"
#include <ctime>
#include <clocale>
using std::endl;
extern string current_layout;
@ -1046,6 +1049,28 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
break;
}
case LFUN_DATE_INSERT: { // jdblair: date-insert cmd
time_t now_time_t = time(NULL);
struct tm * now_tm = localtime(&now_time_t);
setlocale(LC_TIME, "");
string arg;
if (!cmd.argument.empty())
arg = cmd.argument;
else
arg = lyxrc.date_insert_format;
char datetmp[32];
int const datetmp_len =
::strftime(datetmp, 32, arg.c_str(), now_tm);
for (int i = 0; i < datetmp_len; i++) {
insertChar(bv, datetmp[i]);
update(bv, true);
}
selection.cursor = cursor;
bv->moveCursorUpdate(false);
break;
}
case LFUN_SELFINSERT: {
if (cmd.argument.empty())
break;