+1999-12-21 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * src/text2.C (RedoHeightOfParagraph): rename arg cursor -> cur
+ (RedoDrawingOfParagraph): ditto
+ (RedoParagraphs): ditto
+ (RemoveTableRow): ditto
+
+ * src/text.C (Fill): rename arg paperwidth -> paper_width
+
+ * src/buffer.C (insertLyXFile): rename var filename -> fname
+ (writeFile): rename arg filename -> fname
+ (writeFileAscii): ditto
+ (makeLaTeXFile): ditto
+ (makeLinuxDocFile): ditto
+ (makeDocBookFile): ditto
+
+ * src/LaTeX.C (runMakeIndex): change arg name from file -> f
+ (runBibTeX): ditto
+
+ * src/Makefile.am (lyx_SOURCES): add bmtable.c and remove bmtable.C
+
+ * src/bmtable.h: add extern "C" on this file when __cplusplus is
+ defined.
+
+ * src/bmtable.c: new file, a C'ified copy of bmtable.C, this is
+ compiled by a C compilator not C++.
+
+ * src/layout.h (LyXTextClass): added typedef for const_iterator
+ (LyXTextClassList): added typedef for const_iterator + member
+ functions begin and end.
+
+ * src/LyXView.C (UpdateDocumentClassChoice): rewritten to use
+ iterators to fill the choice_class.
+ (updateLayoutChoice): rewritten to use iterators to fill the
+ layoutlist in the toolbar.
+
+ * src/BufferView.h (BufferView::work_area_width): removed unused
+ variable.
+
+ * src/lyx_gui_misc.C (WarnReadonly): added string parameter 'file'
+
+ * src/buffer.C (sgmlOpenTag): drop the use of the static space array
+ (sgmlCloseTag): ditto
+
+ * src/support/lstrings.h: return type of countChar changed to
+ unsigned char.
+
+ * src/support/lstrings.C (countChar): use HAVE_STD_COUNT to choose
+ what version of this func to use. Also made to return unsigned int.
+
+ * configure.in: call LYX_STD_COUNT
+
+ * acinclude.m4 (LYX_STD_COUNT): new function checks for a standard
+ conforming std::count.
+
1999-12-20 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/mathed/math_draw.C (Draw, Metrics): fix a bug where a prime
fi])
+dnl Usage: LYX_STD_COUNT : checks wherer the C++ library have a conforming
+dnl count template, if not the old HP version is assumed.
+AC_DEFUN(LYX_STD_COUNT,[
+AC_CACHE_CHECK(for conforming std::count,lyx_cv_std_count,
+ [AC_TRY_COMPILE([
+#include <string>
+#include <algorithm>
+using std::string;
+using std::count;
+int countChar(string const & a, char const c)
+{
+ return count(a.begin(), a.end(), c);
+}
+],[
+ string a("hello");
+ int i = countChar(a, 'l');
+],lyx_cv_std_count=yes,lyx_cv_std_count=no)
+])
+if test $lyx_cv_std_count = yes ; then
+ AC_DEFINE(HAVE_STD_COUNT, 1,
+ [Define if you have a conforming std::count template, otherwise HP version of count template is assumed.])
+fi])
+
+
dnl Usage: LYX_CXX_STL_MODERN_STREAMS : checks whether the C++ compiler
dnl supports modern STL streams
AC_DEFUN(LYX_CXX_STL_MODERN_STREAMS,[
LYX_CXX_STL_STRING
LYX_CXX_NAMESPACES
LYX_CXX_CHEADERS
+LYX_STD_COUNT
dnl we disable rtti for now
dnl LYX_CXX_RTTI
AC_CHECK_HEADERS(ostream istream)
void BufferView::create_view(int xpos, int ypos, int width, int height)
{
FL_OBJECT * obj;
- const int bw = abs(fl_get_border_width());
+ int const bw = abs(fl_get_border_width());
// a hack for the figinsets (Matthias)
// This one first, then it will probably be invisible. (Lgb)
// the free object
work_area = obj = fl_add_free(FL_INPUT_FREE,
- xpos +bw, ypos+bw,
- width-15-2*bw /* scrollbarwidth */,
- height-2*bw, "",
+ xpos + bw, ypos + bw,
+ width - 15 - 2 * bw /* scrollbarwidth */,
+ height - 2 * bw, "",
C_BufferView_work_area_handler);
obj->wantkey = FL_KEY_TAB;
obj->u_vdata = this; /* This is how we pass the BufferView
fl_set_border_width(-2); // to get visible feedback
#endif
button_up = obj = fl_add_pixmapbutton(FL_TOUCH_BUTTON,
- width-15+4*bw,
+ width - 15 + 4 * bw,
ypos,
15, 15, "");
fl_set_object_boxtype(obj, FL_UP_BOX);
// the scrollbar slider
fl_set_border_width(-bw);
scrollbar = obj = fl_add_slider(FL_VERT_SLIDER,
- width-15+4*bw,
+ width - 15 + 4 * bw,
ypos + 15,
- 15, height-30, "");
+ 15, height - 30, "");
fl_set_object_color(obj, FL_COL1, FL_MCOL);
fl_set_object_boxtype(obj, FL_UP_BOX);
fl_set_object_resize(obj, FL_RESIZE_ALL);
return 1;
}
-int BufferView::WorkAreaMotionNotify(FL_OBJECT *ob, Window,
+int BufferView::WorkAreaMotionNotify(FL_OBJECT * ob, Window,
int /*w*/, int /*h*/,
- XEvent * ev, void */*d*/)
+ XEvent * ev, void * /*d*/)
{
-
if (buffer_ == 0) return 0;
if (!screen) return 0;
}
if (view->lyx_focus && view->work_area_focus) {
- if (!view->buffer_->the_locking_inset){
+ if (!view->buffer_->the_locking_inset) {
view->screen->CursorToggle();
} else {
view->buffer_->the_locking_inset->
goto set_timer_and_return;
} else {
// Make sure that the cursor is visible.
- if (!view->buffer_->the_locking_inset){
+ if (!view->buffer_->the_locking_inset) {
view->screen->ShowCursor();
} else {
if (!view->buffer_->the_locking_inset->isCursorVisible())
}
XFlush(fl_display);
- if (uc){
+ if (uc) {
free(uc);
uc = 0;
}
class BufferView {
public:
///
- BufferView(LyXView *owner, int , int , int, int);
+ BufferView(LyXView * owner, int , int , int, int);
///
~BufferView();
///
///
LyXView * owner() const { return owner_; }
///
- LyXScreen * getScreen()
- {
- fl_set_timer(timer_cursor, 0.4);
- return screen;
- }
+ LyXScreen * getScreen() {
+ fl_set_timer(timer_cursor, 0.4);
+ return screen;
+ }
///
void savePosition();
///
///
long current_scrollbar_value;
///
- int work_area_width;
- ///
bool lyx_focus;
///
bool work_area_focus;
}
-bool LaTeX::runMakeIndex(string const &file)
+bool LaTeX::runMakeIndex(string const & f)
{
lyxerr[Debug::LATEX] << "idx file has been made,"
" running makeindex on file "
- << file << endl;
+ << f << endl;
// It should be possible to set the switches for makeindex
// sorting style and such. It would also be very convenient
// to be able to make style files from within LyX. This has
// to come for a later time. (0.13 perhaps?)
string tmp = "makeindex -c -q ";
- tmp += file;
+ tmp += f;
Systemcalls one;
one.startscript(Systemcalls::System, tmp);
return true;
}
-bool LaTeX::runBibTeX(string const & file, DepTable & dep)
+bool LaTeX::runBibTeX(string const & f, DepTable & dep)
{
// Since a run of Bibtex mandates more latex runs it is ok to
// remove all ".bib" and ".bst" files, it is also required to
// discover style and database changes.
dep.remove_files_with_extension(".bib");
dep.remove_files_with_extension(".bst");
- ifstream ifs(file.c_str());
+ ifstream ifs(f.c_str());
string token;
bool using_bibtex = false;
LRegex reg1("\\\\bibdata{([^}]+)}");
* are presented (and rightly so) in GUI popups. Asger.
*/
{
- FL_OBJECT * obj;
-
- FD_form_main *fdui = (FD_form_main *)
- fl_calloc(1, sizeof(FD_form_main));
+ FD_form_main * fdui = static_cast<FD_form_main *>
+ (fl_calloc(1, sizeof(FD_form_main)));
_form_main = fdui;
// the main form
_form = fdui->form_main = fl_bgn_form(FL_NO_BOX, width, height);
fdui->form_main->u_vdata = this;
- obj = fl_add_box(FL_FLAT_BOX, 0, 0, width, height, "");
+ FL_OBJECT * obj = fl_add_box(FL_FLAT_BOX, 0, 0, width, height, "");
fl_set_object_color(obj, FL_MCOL, FL_MCOL);
// Parameters for the appearance of the main form
- const int air = 2;
- const int bw = abs(fl_get_border_width());
+ int const air = 2;
+ int const bw = abs(fl_get_border_width());
//
// THE MENUBAR
// WORKAREA
//
- const int ywork = 60 + 2*air + bw;
- const int workheight = height - ywork - (25 + 2*air);
+ int const ywork = 60 + 2 * air + bw;
+ int const workheight = height - ywork - (25 + 2 * air);
::current_view = bufferview = new BufferView(this, air, ywork,
- width - 3*air,
+ width - 3 * air,
workheight);
//
// MINIBUFFER
//
- minibuffer = new MiniBuffer(this, air, height-(25+air),
- width-(2*air), 25);
+ minibuffer = new MiniBuffer(this, air, height - (25 + air),
+ width - (2 * air), 25);
//
// TIMERS
if (toolbar->combox->empty() ||
(last_textclass != int(buffer()->params.textclass))) {
toolbar->combox->clear();
- for (int i = 0;
- textclasslist.NameOfLayout(buffer()->
- params.textclass, i) != "@@end@@";
- i++) {
- LyXLayout const & layout = textclasslist.
- Style(buffer()->params.textclass, i);
- if (layout.obsoleted_by().empty())
- toolbar->combox->addline(layout.name().c_str());
+ LyXTextClass const & tc = textclasslist.TextClass(buffer()->params.textclass);
+ for (LyXTextClass::const_iterator cit = tc.begin();
+ cit != tc.end(); ++cit) {
+ if ((*cit).obsoleted_by().empty())
+ toolbar->combox->addline((*cit).name().c_str());
else
- toolbar->combox->addline(("@N"+layout.name()).c_str());
+ toolbar->combox->addline(("@N" + (*cit).name()).c_str());
}
last_textclass = int(buffer()->params.textclass);
current_layout = 0;
// Update the document class display in the document form
if (fd_form_document) {
fl_clear_choice(fd_form_document->choice_class);
- for (int i = 0;
- textclasslist.DescOfClass(i) != "@@end@@"; ++i) {
+ for (LyXTextClassList::const_iterator cit = textclasslist.begin();
+ cit != textclasslist.end(); ++cit) {
fl_addto_choice(fd_form_document->choice_class,
- textclasslist.DescOfClass(i).c_str());
+ (*cit).description().c_str());
}
}
}
Spacing.h \
TableLayout.C \
bibforms.h \
- bmtable.C \
+ bmtable.c \
bmtable.h \
broken_headers.h \
buffer.C \
#include <config.h>
-#include <cstdlib>
+#include <stdlib.h>
#include "bmtable.h"
#include XPM_H_LOCATION
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+
typedef struct {
int nx, ny; /* Dimensions of the table */
int dx, dy; /* Size of each item */
}
}
-
+#if defined(__cplusplus)
+}
+#endif
--- /dev/null
+/*
+ * File: bmtable.c
+ * Purpose: Implementation of the XForms object bmtable.
+ * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
+ * Created: November 1995
+ * Description: A bitmap table uses a single bitmap to simulate a 2d array
+ * of bitmap buttons. It can be used to build bitmap menus.
+ *
+ * Copyright 1995, 1996 Alejandro Aguilar Sierra
+ *
+ * You are free to use and modify this code under the terms of
+ * the GNU General Public Licence version 2 or later.
+ *
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include "bmtable.h"
+#include XPM_H_LOCATION
+
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+
+typedef struct {
+ int nx, ny; /* Dimensions of the table */
+ int dx, dy; /* Size of each item */
+ int bx, by; /* Bitmap's position */
+ int bw, bh; /* Bitmap dimensions */
+ unsigned char const * bdata; /* Bitmap data */
+ int maxi; /* Number of items */
+ int i; /* Current position */
+ int mousebut; /* mouse button pushed */
+ Pixmap pix; /* Pixmap from data (temporal) */
+} BMTABLE_SPEC;
+
+
+int handle_bitmaptable(FL_OBJECT * ob, int event, FL_Coord mx,
+ FL_Coord my, int key, void * xev);
+
+
+FL_OBJECT * fl_create_bmtable(int type, FL_Coord x, FL_Coord y,
+ FL_Coord w, FL_Coord h, char const * label)
+{
+ FL_OBJECT * ob;
+
+ ob = fl_make_object(FL_BMTABLE, type, x, y, w, h, label, handle_bitmaptable);
+ ob->boxtype = FL_BMTABLE_BOXTYPE;
+ ob->spec = fl_calloc(1, sizeof(BMTABLE_SPEC));
+ ((BMTABLE_SPEC *)ob->spec)->pix = 0;
+ ((BMTABLE_SPEC *)ob->spec)->bdata= 0;
+ ((BMTABLE_SPEC *)ob->spec)->mousebut= -1;
+ return ob;
+}
+
+
+FL_OBJECT *fl_add_bmtable(int type, FL_Coord x, FL_Coord y,
+ FL_Coord w, FL_Coord h, char const *label)
+{
+ FL_OBJECT *ob;
+
+ ob = fl_create_bmtable(type, x, y, w, h, label);
+ fl_add_object(fl_current_form, ob);
+
+ return ob;
+}
+
+
+static void draw_bitmaptable(FL_OBJECT *ob)
+{
+ int i, j, lx;
+ FL_Coord mx, my;
+ FL_Coord xx, yy, ww, hh;
+ BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec;
+ GC gc = fl_state[fl_get_vclass()].gc[0];
+ if (!sp) return;
+
+ /* draw the bounding box first */
+ lx = sp->maxi % sp->nx;
+ fl_drw_box(ob->boxtype, ob->x, ob->y, ob->w, ob->h, ob->col1, ob->bw);
+ if (lx) {
+ i = FL_abs(ob->bw);
+ xx = ob->x+ sp->dx*lx + i;
+ yy = ob->y+ (sp->ny-1)*sp->dy+i;
+ ww = ob->x+ob->w - xx - i;
+ hh = ob->y+ob->h-yy-i;
+ fl_drw_frame(FL_DOWN_FRAME, xx, yy, ww, hh, ob->col1, ob->bw);
+ fl_rectf(xx, yy, ww+i, hh+i, ob->col1);
+ }
+
+ /* draw the background bitmap */
+ if (sp->bdata) {
+ if (!sp->pix) {
+ sp->pix = XCreatePixmapFromBitmapData(fl_display, fl_winget(),
+ (char*)sp->bdata,
+ sp->bw, sp->bh,
+ fl_get_flcolor(ob->lcol), fl_get_flcolor(ob->col1),
+ /*DefaultDepth(fl_display, DefaultScreen(fl_display))*/ fl_state[fl_get_vclass()].depth);
+ XFlush(fl_display);
+ }
+ }
+ if (sp->pix) {
+ /* Adjust position */
+ if (sp->bx < FL_abs(ob->bw) + 1) {
+ xx = FL_abs(ob->bw) - sp->bx + 1;
+ mx = ob->x + FL_abs(ob->bw) + 1;
+ } else {
+ xx = 0;
+ mx = ob->x + sp->bx;
+ }
+ if (sp->by < FL_abs(ob->bw) + 1) {
+ yy = FL_abs(ob->bw) - sp->by + 1;
+ my = ob->y + FL_abs(ob->bw) + 1;
+ } else {
+ yy = 0;
+ my = ob->y + sp->by;
+ }
+ ww = (mx + sp->bw < ob->x + ob->w - FL_abs(ob->bw)) ?
+ sp->bw: ob->x + ob->w - FL_abs(ob->bw) - mx;
+ hh = (my + sp->bh < ob->y + ob->h - FL_abs(ob->bw)) ?
+ sp->bh: ob->y + ob->h - FL_abs(ob->bw) - my;
+
+ i = FL_abs(ob->bw);
+ j = hh - ((lx) ? sp->dy+2*i: 0);
+ XCopyArea(fl_display, sp->pix, fl_winget(), gc, xx, yy, ww, j, mx, my);
+ XFlush(fl_display);
+ if (lx) {
+ XCopyArea(fl_display, sp->pix, fl_winget(), gc, xx,
+ yy+j, lx*sp->dx-2*i, hh-j, mx, my+j);
+ XFlush(fl_display);
+ }
+ }
+
+
+ /* draw the grid if type > FLAT */
+ if (ob->type > FL_BMTABLE_FLAT) {
+ mx = ob->x + ob->w;
+ my = ob->y + ob->h;
+ ww = ob->w;
+ for (yy= ob->y; yy<= my; yy+= sp->dy) {
+ if (ob->boxtype!= FL_FLAT_BOX && (yy == ob->y || yy>my-sp->dy))
+ continue;
+ if (lx>0 && yy>= my-sp->dy - sp->dy/2)
+ ww = lx*sp->dx;
+ fl_diagline(ob->x, yy, ww, 1, FL_BOTTOM_BCOL);
+ fl_diagline(ob->x, yy+1, ww-2, 1, FL_TOP_BCOL);
+ }
+ hh = ob->h;
+ for (xx= ob->x; xx<= mx; xx+= sp->dx) {
+ if (ob->boxtype!= FL_FLAT_BOX && (xx == ob->x || xx>mx-sp->dx))
+ continue;
+ if (lx>0 && xx>= ob->x+lx*sp->dx)
+ hh = (sp->ny-1)*sp->dy;
+ fl_diagline(xx, ob->y, 1, hh, FL_RIGHT_BCOL);
+ fl_diagline(xx+1, ob->y+1, 1, hh-2, FL_LEFT_BCOL);
+ }
+ }
+
+ /* Simulate a pushed button */
+ if (ob->pushed && 0 <= sp->i && sp->i < sp->maxi) {
+ i = sp->i % sp->nx;
+ j = sp->i/sp->nx;
+ ww = sp->dx-2*FL_abs(ob->bw);
+ hh = sp->dy-2*FL_abs(ob->bw);
+ xx = ob->x + sp->dx*i + FL_abs(ob->bw);
+ yy = ob->y + sp->dy*j + FL_abs(ob->bw);
+ fl_drw_frame(FL_DOWN_FRAME, xx, yy, ww, hh, ob->col1, ob->bw);
+ }
+}
+
+
+int handle_bitmaptable(FL_OBJECT * ob, int event, FL_Coord mx,
+ FL_Coord my, int key, void * xev)
+{
+ int i, j;
+ BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec;
+
+ switch (event) {
+ case FL_DRAW:
+ draw_bitmaptable(ob);
+ break;
+ case FL_MOUSE:
+ if (!ob->belowmouse) { /* This never happens. Why? */
+ sp->i = -1;
+ fl_redraw_object(ob);
+ break;
+ }
+ i = (mx - ob->x)/sp->dx; j = (my - ob->y)/sp->dy;
+ if (i>= 0 && i< sp->nx && j>= 0 && j< sp->ny) {
+ i += j*sp->nx;
+ if (i >= sp->maxi) i = -1;
+ if (sp->i != i) {
+ sp->i = i;
+ fl_redraw_object(ob);
+ }
+ }
+ break;
+ case FL_PUSH:
+ sp->mousebut = key;
+ i = (mx - ob->x)/sp->dx + ((my - ob->y)/sp->dy)*sp->nx;
+ if (0 <= i && i < sp->maxi) {
+ sp->i = i;
+ fl_redraw_object(ob);
+ } else
+ sp->i = -1;
+ break;
+ case FL_RELEASE:
+ fl_redraw_object(ob);
+ return 1;
+ case FL_FREEMEM:
+ if (sp->pix) {
+ XFreePixmap(fl_display, sp->pix);
+ XFlush(fl_display);
+ }
+ fl_free(((BMTABLE_SPEC*)ob->spec));
+ break;
+ }
+ return 0;
+}
+
+
+/*
+ * The table has nx columns of dx width each and ny rows of dy height each.
+ * Initially the position of the firts item is supposed to be the same that
+ * the object position (x, y), and the number of items is supposed to be
+ * exactly nx*ny.
+ *
+ * The user could change these later. See below.
+ */
+void fl_set_bmtable_data(FL_OBJECT * ob, int nx, int ny, int bw, int bh,
+ unsigned char const * bdata)
+{
+ BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec;
+ if (sp) {
+ sp->nx = nx;
+ sp->ny = ny;
+ sp->bx = FL_abs(ob->bw);
+ sp->by = FL_abs(ob->bw);
+ sp->dx = ob->w/nx;
+ sp->dy = ob->h/ny;
+ sp->i = -1;
+ sp->maxi = sp->nx * sp->ny;
+ sp->bw = bw;
+ sp->bh = bh;
+ sp->bdata = bdata;
+ }
+}
+
+
+void fl_set_bmtable_pixmap_data(FL_OBJECT * ob, int nx, int ny,
+ char ** pdata)
+{
+ BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec;
+ extern Colormap color_map;
+ if (sp) {
+ Pixmap dummy_shapemask = 0;
+#if 0
+ // I can't see why this initalization is needed. (Lgb)
+ XpmAttributes dumb_attributes = {0};
+#else
+ XpmAttributes dumb_attributes;
+#endif
+ sp->nx = nx;
+ sp->ny = ny;
+ sp->bx = FL_abs(ob->bw);
+ sp->by = FL_abs(ob->bw);
+ sp->dx = ob->w/nx;
+ sp->dy = ob->h/ny;
+ sp->i = -1;
+ sp->maxi = sp->nx * sp->ny;
+ sp->bdata = 0;
+ dumb_attributes.colormap = color_map;
+ dumb_attributes.closeness = 30000;
+ dumb_attributes.valuemask = XpmColormap | XpmCloseness;
+ if (XCreatePixmapFromData(fl_display, fl_winget(), pdata,
+ &(sp->pix), &dummy_shapemask,
+ &dumb_attributes) == XpmSuccess) {
+ sp->bw = dumb_attributes.width;
+ sp->bh = dumb_attributes.height;
+ XpmFreeAttributes(&dumb_attributes);
+ if (dummy_shapemask) {
+ XFreePixmap(fl_display, dummy_shapemask);
+ }
+ }
+ XFlush(fl_display);
+ }
+}
+
+
+/*
+ * This function works only for X11R6 or later
+ */
+#if XlibSpecificationRelease > 5
+
+void fl_set_bmtable_file(FL_OBJECT * ob, int nx, int ny, char const * filename)
+{
+ int xh, yh;
+ unsigned int bw, bh;
+ unsigned char * bdata;
+
+ if(XReadBitmapFileData(filename, &bw, &bh,
+ &bdata, &xh, &yh) == BitmapSuccess)
+ fl_set_bmtable_data(ob, nx, ny, bw, bh, bdata);
+ XFlush(fl_display);
+}
+
+#else
+
+void fl_set_bmtable_file(FL_OBJECT *, int, int, char const *)
+{
+ fprintf(stderr, "Set bmtable file: Sorry, I need X11 release 6 to do "
+ "work!\n");
+}
+
+#endif
+
+
+
+void fl_set_bmtable_pixmap_file(FL_OBJECT *ob, int nx, int ny, char const *filename)
+{
+ extern Colormap color_map;
+ BMTABLE_SPEC *sp = (BMTABLE_SPEC *)ob->spec;
+ if (sp) {
+ Pixmap dummy_shapemask = 0;
+#if 0
+ XpmAttributes dumb_attributes = {0};
+#else
+ XpmAttributes dumb_attributes;
+#endif
+ sp->nx = nx;
+ sp->ny = ny;
+ sp->bx = FL_abs(ob->bw);
+ sp->by = FL_abs(ob->bw);
+ sp->dx = ob->w/nx;
+ sp->dy = ob->h/ny;
+ sp->i = -1;
+ sp->maxi = sp->nx * sp->ny;
+ sp->bdata = 0;
+
+ dumb_attributes.colormap = color_map;
+ dumb_attributes.closeness = 30000;
+ dumb_attributes.valuemask = XpmColormap | XpmCloseness;
+
+ if (XReadPixmapFile(fl_display, fl_winget(), (char *)filename,
+ &(sp->pix), &dummy_shapemask,
+ &dumb_attributes) == XpmSuccess) {
+ sp->bw = dumb_attributes.width;
+ sp->bh = dumb_attributes.height;
+ XpmFreeAttributes(&dumb_attributes);
+ if (dummy_shapemask) {
+ XFreePixmap(fl_display, dummy_shapemask);
+ }
+ }
+ XFlush(fl_display);
+ }
+}
+
+
+/*
+ * This function allows to adjust the position of the first item and its
+ * size (dx, dy). The input values are incremental, not absolute.
+ */
+void fl_set_bmtable_adjust(FL_OBJECT *ob, int px, int py, int dx, int dy)
+{
+ BMTABLE_SPEC *sp = (BMTABLE_SPEC *)ob->spec;
+ if (sp) {
+ sp->bx += px;
+ sp->by += py;
+ sp->dx += dx;
+ sp->dy += dy;
+ }
+}
+
+/*
+ * This function returns the table's selected position.
+ */
+int fl_get_bmtable(FL_OBJECT *ob)
+{
+ if ((BMTABLE_SPEC *)ob->spec)
+ return ((BMTABLE_SPEC *)ob->spec)->i;
+ else
+ return 0;
+}
+
+
+/*
+ * You can change the max number of items if you want.
+ */
+void fl_set_bmtable_maxitems(FL_OBJECT * ob, int i)
+{
+ if (i > 0 && (BMTABLE_SPEC *)ob->spec)
+ ((BMTABLE_SPEC *)ob->spec)->maxi = i;
+}
+
+
+int fl_get_bmtable_maxitems(FL_OBJECT * ob)
+{
+ if ((BMTABLE_SPEC *)ob->spec)
+ return ((BMTABLE_SPEC *)ob->spec)->maxi;
+ else
+ return 0;
+}
+
+
+void fl_replace_bmtable_item(FL_OBJECT * ob, int id, int cw, int ch, char * data)
+{
+ fprintf(stderr, "Replace bmtable item: Sorry, not yet implemented!\n");
+}
+
+
+void fl_get_bmtable_item(FL_OBJECT * ob, int id, int * cw, int * ch, char * data)
+{
+ fprintf(stderr, "Get bmtable item: Sorry, not yet implemented!\n");
+}
+
+void fl_set_bmtable(FL_OBJECT * ob, int pushed, int pos)
+{
+ if ((BMTABLE_SPEC *)ob->spec)
+ ((BMTABLE_SPEC *)ob->spec)->i = (pushed) ? pos: -1;
+}
+
+
+int fl_get_bmtable_numb(FL_OBJECT *ob)
+{
+ if ((BMTABLE_SPEC *)ob->spec)
+ return ((BMTABLE_SPEC *)ob->spec)->mousebut;
+ else
+ return 0;
+}
+
+
+Pixmap fl_get_bmtable_pixmap(FL_OBJECT * ob)
+{
+ if ((BMTABLE_SPEC *)ob->spec)
+ return ((BMTABLE_SPEC *)ob->spec)->pix;
+ else
+ return 0;
+}
+
+
+void fl_draw_bmtable_item(FL_OBJECT * ob, int i, Drawable d, int xx, int yy)
+{
+ int x, y, w, h;
+ GC gc = fl_state[fl_get_vclass()].gc[0];
+ BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec;
+
+ if (sp && sp->pix) {
+ x = (i % sp->nx)*sp->dx + FL_abs(ob->bw);
+ y = (i/sp->nx)*sp->dy + FL_abs(ob->bw);
+ w = sp->dx-2*FL_abs(ob->bw);
+ h = sp->dy-2*FL_abs(ob->bw);
+ XCopyArea(fl_display, sp->pix, d, gc, x, y, w, h, xx, yy);
+ XFlush(fl_display);
+ }
+}
+
+/* Free the current bitmap and pixmap in preparation for installing a new one */
+void fl_free_bmtable_bitmap(FL_OBJECT * ob)
+{
+ BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec;
+
+ /* dump the temporary pixmap */
+ if (sp && sp->pix) {
+ XFreePixmap(fl_display, sp->pix);
+ XFlush(fl_display);
+ sp->pix = 0;
+ }
+
+ /* and free the space taken by bdata etc. */
+ if (sp && sp->bdata) {
+ fl_free((void*)sp->bdata);
+ sp->bdata = 0;
+ }
+}
+
+/* Free the current pixmap in preparation for installing a new one */
+/* This is needed when using data instead of files to set bitmaps */
+void fl_free_bmtable_pixmap(FL_OBJECT *ob)
+{
+ BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec;
+
+ /* dump the temporary pixmap */
+ if (sp && sp->pix) {
+ XFreePixmap(fl_display, sp->pix);
+ XFlush(fl_display);
+ sp->pix = 0;
+ }
+}
+
+#if defined(__cplusplus)
+}
+#endif
#include FORMS_H_LOCATION
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+
///
#define FL_BMTABLE 1500
/// A flat bitmap table
*/
#define FL_BMTABLE_BOXTYPE FL_UP_BOX
+
///
FL_OBJECT *fl_create_bmtable(int, FL_Coord, FL_Coord,
FL_Coord, FL_Coord, char const *);
/** Free the current pixmap in preparation for installing a new one */
void fl_free_bmtable_pixmap(FL_OBJECT *ob);
+#if defined(__cplusplus)
+}
+#endif
+
#endif /* BMTABLE_H */
{
if (filen.empty()) return false;
- string filename = MakeAbsPath(filen);
+ string fname = MakeAbsPath(filen);
// check if file exist
- FileInfo fi(filename);
+ FileInfo fi(fname);
if (!fi.readable()) {
WriteAlert(_("Error!"),
_("Specified file is unreadable: "),
- MakeDisplayPath(filename, 50));
+ MakeDisplayPath(fname, 50));
return false;
}
BeforeChange();
- FilePtr myfile(filename, FilePtr::read);
+ FilePtr myfile(fname, FilePtr::read);
if (!myfile()) {
WriteAlert(_("Error!"),
_("Cannot open specified file: "),
- MakeDisplayPath(filename, 50));
+ MakeDisplayPath(fname, 50));
return false;
}
LyXLex lex(0, 0);
// Returns false if unsuccesful
-bool Buffer::writeFile(string const & filename, bool flag)
+bool Buffer::writeFile(string const & fname, bool flag)
{
// if flag is false writeFile will not create any GUI
// warnings, only cerr.
// Needed for autosave in background or panic save (Matthias 120496)
- if (read_only && (filename == this->filename)) {
+ if (read_only && (fname == filename)) {
// Here we should come with a question if we should
// perform the write anyway.
if (flag)
lyxerr << _("Error! Document is read-only: ")
- << filename << endl;
+ << fname << endl;
else
WriteAlert(_("Error! Document is read-only: "),
- filename);
+ fname);
return false;
}
- FileInfo finfo(filename);
+ FileInfo finfo(fname);
if (finfo.exist() && !finfo.writable()) {
// Here we should come with a question if we should
// try to do the save anyway. (i.e. do a chmod first)
if (flag)
lyxerr << _("Error! Cannot write file: ")
- << filename << endl;
+ << fname << endl;
else
WriteFSAlert(_("Error! Cannot write file: "),
- filename);
+ fname);
return false;
}
- ofstream ofs(filename.c_str());
+ ofstream ofs(fname.c_str());
if (!ofs) {
if (flag)
lyxerr << _("Error! Cannot open file: ")
- << filename << endl;
+ << fname << endl;
else
WriteFSAlert(_("Error! Cannot open file: "),
- filename);
+ fname);
return false;
}
// The top of the file should not be written by params.
}
-void Buffer::writeFileAscii(string const & filename, int linelen)
+void Buffer::writeFileAscii(string const & fname, int linelen)
{
LyXFont font1, font2;
Inset * inset;
long fpos = 0;
bool ref_printed = false;
- ofstream ofs(filename.c_str());
+ ofstream ofs(fname.c_str());
if (!ofs) {
- WriteFSAlert(_("Error: Cannot write file:"), filename);
+ WriteFSAlert(_("Error: Cannot write file:"), fname);
return;
}
}
-void Buffer::makeLaTeXFile(string const & filename,
+void Buffer::makeLaTeXFile(string const & fname,
string const & original_path,
bool nice, bool only_body)
{
LyXTextClass const & tclass =
textclasslist.TextClass(params.textclass);
- ofstream ofs(filename.c_str());
+ ofstream ofs(fname.c_str());
if (!ofs) {
- WriteFSAlert(_("Error: Cannot open file: "), filename);
+ WriteFSAlert(_("Error: Cannot open file: "), fname);
return;
}
void Buffer::sgmlOpenTag(ostream & os, int depth,
string const & latexname) const
{
- static char * space[] = {" "," ", " ", " ", " ", " ",
- " ",
- " ", " ", " ",
- " "};
-
+#if 0
+ static char const * space[] = {
+ " "," ", " ", " ", " ", " ",
+ " ",
+ " ", " ", " ",
+ " "};
os << space[depth] << "<" << latexname << ">\n";
+#endif
+ os << string(depth, ' ') << "<" << latexname << ">\n";
}
void Buffer::sgmlCloseTag(ostream & os, int depth,
string const & latexname) const
{
+#if 0
static char * space[] = {" ", " ", " ", " ", " ",
" ", " ", " ",
" ", " ", " "};
os << space[depth] << "</" << latexname << ">\n";
+#endif
+ os << string(depth, ' ') << "</" << latexname << ">\n";
}
-void Buffer::makeLinuxDocFile(string const & filename, int column)
+void Buffer::makeLinuxDocFile(string const & fname, int column)
{
LyXParagraph * par = paragraph;
int depth = 0; /* paragraph depth */
- ofstream ofs(filename.c_str());
+ ofstream ofs(fname.c_str());
if (!ofs) {
- WriteAlert(_("LYX_ERROR:"), _("Cannot write file"), filename);
+ WriteAlert(_("LYX_ERROR:"), _("Cannot write file"), fname);
return;
}
enum { MAX_NEST_LEVEL = 25};
-void Buffer::makeDocBookFile(string const & filename, int column)
+void Buffer::makeDocBookFile(string const & fname, int column)
{
LyXParagraph * par = paragraph;
tex_code_break_column = column;
- ofstream ofs(filename.c_str());
+ ofstream ofs(fname.c_str());
if (!ofs) {
- WriteAlert(_("LYX_ERROR:"), _("Cannot write file"), filename);
+ WriteAlert(_("LYX_ERROR:"), _("Cannot write file"), fname);
return;
}
#include "texrow.h"
#include "lyxtext.h"
#include "support/filetools.h"
+#include "lyx_gui_misc.h"
class LyXRC;
class LaTeXFeatures;
extern void updateAllVisibleBufferRelatedPopups();
-extern void WarnReadonly();
///
struct DEPCLEAN {
bool isReadonly() { return read_only; }
/// Set buffer read-only flag
- void setReadonly(bool flag = true)
- {
- if (read_only != flag) {
- read_only = flag;
- updateTitles();
- updateAllVisibleBufferRelatedPopups();
- }
- if (read_only) {
- WarnReadonly();
- }
+ void setReadonly(bool flag = true) {
+ if (read_only != flag) {
+ read_only = flag;
+ updateTitles();
+ updateAllVisibleBufferRelatedPopups();
+ }
+ if (read_only) {
+ WarnReadonly(filename);
}
+ }
/// returns true if the buffer contains a LaTeX document
bool isLatex() const;
// The actual prevention of altering a readonly doc
// is done in CallbackFig()
if(current_view->buffer()->isReadonly())
- WarnReadonly();
+ WarnReadonly(current_view->buffer()->fileName());
if (!form) {
form = create_form_Figure();
void InsetCitation::Edit(int, int)
{
if(current_view->buffer()->isReadonly())
- WarnReadonly();
+ WarnReadonly(current_view->buffer()->fileName());
if (!citation_form) {
citation_form = create_form_citation_form();
void InsetBibKey::Edit(int, int)
{
if(current_view->buffer()->isReadonly())
- WarnReadonly();
+ WarnReadonly(current_view->buffer()->fileName());
if (!bibitem_form) {
bibitem_form = create_form_bibitem_form();
void InsetInclude::Edit(int, int)
{
if(current_view->buffer()->isReadonly())
- WarnReadonly();
+ WarnReadonly(current_view->buffer()->fileName());
if (!form) {
form = create_form_include();
#include "LaTeXFeatures.h"
#include "gettext.h"
#include "LString.h"
-#include "lyx_gui_misc.h" // WarnReadonly()
+#include "lyx_gui_misc.h" // WarnReadonly
extern BufferView * current_view;
extern void UpdateInset(Inset * inset, bool mark_dirty = true);
void InsetIndex::Edit(int, int)
{
if(current_view->buffer()->isReadonly())
- WarnReadonly();
+ WarnReadonly(current_view->buffer()->fileName());
if (!index_form)
index_form = create_form_index_form();
static int ow = -1, oh;
if(current_view->buffer()->isReadonly())
- WarnReadonly();
+ WarnReadonly(current_view->buffer()->fileName());
if (!form) {
FL_OBJECT *obj;
static int ow = -1, oh;
if(current_view->buffer()->isReadonly())
- WarnReadonly();
+ WarnReadonly(current_view->buffer()->fileName());
if (!fd_form_url) {
fd_form_url = create_form_form_url();
void Intl::update()
{
- int off, prim, sec;
-
- off = prim = sec = 0;
+ int off = 0;
+ int prim = 0;
+ int sec = 0;
if (!keymapon) {
off = 1;
if (itl!= 0) itl->Keymap(code);
}
+
extern "C" void C_Intl_DispatchCallback(FL_OBJECT * ob, long code)
{
Intl::DispatchCallback(ob, code);
}
+
void Intl::InitKeyMapper(bool on)
/* initialize key mapper */
{
Language->addto(_("other..."));
Language2->addto(_("other..."));
- otherkeymap = n+1;
+ otherkeymap = n + 1;
if (!Language->select_text(prim_lang.c_str())) {
Language->select(n+1);
fl_set_input(fd_form_keymap->OtherKeymap, prim_lang.c_str());
trans->SetPrimary(prim_lang);
if (!Language2->select_text(sec_lang.c_str())) {
- Language2->select(n+1);
+ Language2->select(n + 1);
fl_set_input(fd_form_keymap->OtherKeymap2, sec_lang.c_str());
}
else
if (lyxerr.debugging(Debug::KBMAP))
lyxerr << "KeyMap callback: " << code << endl;
+ // Did you wonder if it is possible to write spagetti code with
+ // other constructs thatn goto's? Well here we have a nice small
+ // spagetti example using a switch... (Lgb)
switch (code) {
case 0:
/* cancel/hide */
Returns : length of printed string if ok, 0 otherwise.
\* ---F------------------------------------------------------------------- */
static
-void printKeysym( KeySym key, unsigned int mod, string & buf)
+void printKeysym(KeySym key, unsigned int mod, string & buf)
{
mod &= ModsMask;
\* ---F------------------------------------------------------------------- */
static
-void printKeyTab( kb_key * tabPt, string & buf)
+void printKeyTab(kb_key * tabPt, string & buf)
{
unsigned int ksym, mod;
int kb_sequence::parse(char const * s)
{
+ if(!s[0]) return 1;
+
int i = 0;
unsigned int mod = 0, nmod = 0;
- KeySym key = 0;
- char tbuf[100];
-
- if(!s[0]) return 1;
-
while(s[i]) {
if(s[i] && (s[i]) <= ' ') ++i;
if(!s[i]) break;
- if(s[i+1] == '-') { // is implicit that s[i] == true
+ if(s[i + 1] == '-') { // is implicit that s[i] == true
switch(s[i]) {
case 's': case 'S':
mod |= ShiftMask;
- i+= 2;
+ i += 2;
continue;
case 'c': case 'C':
mod |= ControlMask;
- i+= 2;
+ i += 2;
continue;
case 'm': case 'M':
mod |= Mod1Mask;
- i+= 2;
+ i += 2;
continue;
default:
- return i+1;
+ return i + 1;
}
- } else if(s[i] == '~' && s[i+1] && s[i+2] == '-') {
- switch(s[i+1]) {
+ } else if(s[i] == '~' && s[i + 1] && s[i + 2] == '-') {
+ switch(s[i + 1]) {
case 's': case 'S':
nmod |= ShiftMask;
- i+= 3;
+ i += 3;
continue;
case 'c': case 'C':
nmod |= ControlMask;
- i+= 3;
+ i += 3;
continue;
case 'm': case 'M':
nmod |= Mod1Mask;
- i+= 3;
+ i += 3;
continue;
default:
- return i+2;
+ return i + 2;
}
} else {
- int j = 0;
- for(j = i; s[j] && s[j] > ' '; ++j)
- tbuf[j-i] = s[j]; // (!!!check bounds :-)
+ string tbuf;
+ int j = i;
+ for(; s[j] && s[j] > ' '; ++j)
+ tbuf += s[j]; // (!!!check bounds :-)
- tbuf[j-i] = '\0';
-
- key = XStringToKeysym(tbuf);
+ KeySym key = XStringToKeysym(tbuf.c_str());
if(key == NoSymbol) {
lyxerr[Debug::KBMAP]
<< "kbmap.C: No such keysym: "
int l = length;
if(l == 0) return NoSymbol;
if(l < 0) l = -l;
- return sequence[l-1];
+ return sequence[l - 1];
}
{
delseq();
curmap = stdmap;
- if ( length > 0 ) length = -length;
+ if (length > 0) length = -length;
}
#ifndef NO_HASH
if(size < 0) { // --- if hash table ---
- hashval = ((key&0xff) ^ ((key>>8)&0xff)) % KB_HASHSIZE;
+ hashval = ((key & 0xff) ^ ((key >> 8) & 0xff)) % KB_HASHSIZE;
tab = htable[hashval];
if(!tab) {
seq->curmap = seq->stdmap;
// --- now search the list of keys ---
- for( ; (tab->code & 0xffff) != NoSymbol; ++tab) {
+ for(; (tab->code & 0xffff) != NoSymbol; ++tab) {
ksym = tab->code;
msk1 = tab->mod & 0xffff;
msk0 = (tab->mod >> 16) & 0xffff;
int tsize;
for(t = tab, tsize = 1; t->code != NoSymbol; ++t, ++tsize) {
if(code == t->code && modmsk == t->mod) { // -- overwrite binding ---
- if(idx+1 == seq->length) {
+ if(idx + 1 == seq->length) {
string buf;
seq->print(buf, true);
lyxerr[Debug::KEY]
public:
///
typedef vector<LyXLayout> LayoutList;
+ ///
+ typedef LayoutList::const_iterator const_iterator;
///
LyXTextClass (string const & = string(),
string const & = string());
///
- LayoutList::const_iterator begin() const { return layoutlist.begin(); }
+ const_iterator begin() const { return layoutlist.begin(); }
///
- LayoutList::const_iterator end() const { return layoutlist.end(); }
+ const_iterator end() const { return layoutlist.end(); }
///
bool Read(string const & filename, bool merge = false);
public:
///
typedef vector<LyXTextClass> ClassList;
+ ///
+ typedef ClassList::const_iterator const_iterator;
+ ///
+ const_iterator begin() const { return classlist.begin(); }
+ ///
+ const_iterator end() const { return classlist.end(); }
+
/// Gets layout structure from layout number and textclass number
LyXLayout const & Style(ClassList::size_type textclass,
LyXTextClass::LayoutList::size_type layout) const;
#include "banner.xpm"
#endif
-FD_form_title *fd_form_title;
-FD_form_paragraph *fd_form_paragraph;
-FD_form_paragraph_extra *fd_form_paragraph_extra;
-FD_form_search *fd_form_search;
-FD_form_character *fd_form_character;
-FD_form_document *fd_form_document;
-FD_form_paper *fd_form_paper;
-FD_form_table_options *fd_form_table_options;
-FD_form_table_extra *fd_form_table_extra;
-FD_form_quotes *fd_form_quotes;
-FD_form_preamble *fd_form_preamble;
-FD_form_table *fd_form_table;
-FD_form_print *fd_form_print;
-FD_form_sendto *fd_form_sendto;
-FD_form_figure *fd_form_figure;
-FD_form_screen *fd_form_screen;
-FD_form_toc *fd_form_toc;
-FD_form_ref *fd_form_ref;
-FD_LaTeXOptions *fd_latex_options; // from latexoptions.h
-FD_LaTeXLog *fd_latex_log; // from latexoptions.h
-Combox *combo_language;
-
-extern LyXServer *lyxserver;
+FD_form_title * fd_form_title;
+FD_form_paragraph * fd_form_paragraph;
+FD_form_paragraph_extra * fd_form_paragraph_extra;
+FD_form_search * fd_form_search;
+FD_form_character * fd_form_character;
+FD_form_document * fd_form_document;
+FD_form_paper * fd_form_paper;
+FD_form_table_options * fd_form_table_options;
+FD_form_table_extra * fd_form_table_extra;
+FD_form_quotes * fd_form_quotes;
+FD_form_preamble * fd_form_preamble;
+FD_form_table * fd_form_table;
+FD_form_print * fd_form_print;
+FD_form_sendto * fd_form_sendto;
+FD_form_figure * fd_form_figure;
+FD_form_screen * fd_form_screen;
+FD_form_toc * fd_form_toc;
+FD_form_ref * fd_form_ref;
+FD_LaTeXOptions * fd_latex_options; // from latexoptions.h
+FD_LaTeXLog * fd_latex_log; // from latexoptions.h
+Combox * combo_language;
+
+extern LyXServer * lyxserver;
extern bool finished; // flag, that we are quitting the program
extern BufferList bufferlist;
}
-LyXGUI::LyXGUI(LyX *owner, int *argc, char *argv[], bool GUI)
- :_owner(owner)
+LyXGUI::LyXGUI(LyX * owner, int * argc, char * argv[], bool GUI)
+ : _owner(owner)
{
gui = GUI;
if (!gui)
// A destructor is always necessary (asierra-970604)
-LyXGUI::~LyXGUI() {
+LyXGUI::~LyXGUI()
+{
// Lyxserver was created in this class so should be destroyed
// here. asierra-970604
if (lyxserver) {
fl_set_counter_precision(fd_form_document->slider_tocdepth, 0);
fl_addto_form(fd_form_document->form_document);
combo_language = new Combox(FL_COMBOX_DROPLIST);
- FL_OBJECT *ob = fd_form_document->choice_language;
+ FL_OBJECT * ob = fd_form_document->choice_language;
combo_language->add(ob->x, ob->y, ob->w, ob->h, 200);
combo_language->shortcut("#G", 1);
fl_end_form();
int n; // declared here because DEC cxx does not like multiple
// declarations of variables in for() loops (JMarc)
- for (n = 0; tex_babel[n][0]; n++) {
+ for (n = 0; tex_babel[n][0]; ++n) {
combo_language->addto(tex_babel[n]);
}
// not really necessary, but we can do it anyway.
fl_addto_choice(fd_form_document->choice_fontsize, "default|10|11|12");
- for (n = 0; tex_fonts[n][0]; n++) {
+ for (n = 0; tex_fonts[n][0]; ++n) {
fl_addto_choice(fd_form_document->choice_fonts, tex_fonts[n]);
}
"default|latin1|latin2|latin5"
"|koi8-r|koi8-u|cp866|cp1251");
- for (n = 0; tex_graphics[n][0]; n++) {
+ for (n = 0; tex_graphics[n][0]; ++n) {
fl_addto_choice(fd_form_document->choice_postscript_driver,
tex_graphics[n]);
}
}
-void LyXGUI::regBuf(Buffer *b)
+void LyXGUI::regBuf(Buffer * b)
{
lyxViews->view()->buffer(b);
}
#include "insets/insetindex.h"
#include "LyXView.h"
-extern BufferView *current_view;
+extern BufferView * current_view;
extern FD_form_paragraph * fd_form_paragraph;
extern FD_form_paragraph_extra * fd_form_paragraph_extra;
}
// Extract shortcut from <ident>|<shortcut> string
-const char* flyx_shortcut_extract(const char*sc)
+char const * flyx_shortcut_extract(char const * sc)
{
// Find '|' in the sc and return the string after that.
- register char const *sd = sc;
- while(sd[0]!= 0 && sd[0] != '|') sd++;
+ register char const * sd = sc;
+ while(sd[0]!= 0 && sd[0] != '|') ++sd;
if (sd[0] == '|') {
- sd++;
+ ++sd;
//lyxerr << sd << endl;
return sd;
}
return "";
}
+
// Extract identifier from <ident>|<shortcut> string
-const char* flyx_ident_extract(char const *sc)
+char const * flyx_ident_extract(char const * sc)
{
- register char const *se = sc;
- while(se[0]!= 0 && se[0] != '|') se++;
+ register char const * se = sc;
+ while(se[0]!= 0 && se[0] != '|') ++se;
if (se[0] == 0) return sc;
- char * sb = new char[se-sc + 1];
+ char * sb = new char[se - sc + 1];
int index = 0;
- register char const *sd = sc;
+ register char const * sd = sc;
while (sd != se) {
sb[index] = sd[0];
- index++; sd++;
+ ++index; ++sd;
}
sb[index] = 0;
return sb;
}
+
//
void WriteAlert(string const & s1, string const & s2, string const & s3)
{
#endif
}
+
// Returns 1 for yes, 2 for no, 3 for cancel.
int AskConfirmation(string const & s1, string const & s2, string const & s3)
{
// Asks for a text
string askForText(string const & msg, string const & dflt)
{
- const char * tmp;
+ char const * tmp;
fl_set_resource("flInput.cancel.label", idex(_("Cancel|^[")));
fl_set_resource("flInput.ok.label", idex(_("OK|#O")));
fl_set_resource("flInput.clear.label", idex(_("Clear|#e")));
return string();
}
+
// Inform the user that the buffer is read-only, and that changes in the
// dialog box that is to appear will be ignored.
-void WarnReadonly()
+void WarnReadonly(string const & file)
{
WriteAlert(_("Any changes will be ignored"),
_("The document is read-only:"),
- current_view->buffer()->fileName());
+ file);
}
-
// -*- C++ -*-
/* This file is part of
-* ======================================================
-*
-* LyX, The Document Processor
-*
-* Copyright (C) 1995 1996 Matthias Ettrich
-* and the LyX Team.
-*
-* ====================================================== */
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 1995 1996 Matthias Ettrich
+ * Copyright 1995-1999 The LyX Team
+ *
+ * ====================================================== */
// Misc. GUI specific routines
void updateAllVisibleBufferRelatedPopups();
/// Extract shortcut from <ident>|<shortcut> string
-const char* flyx_shortcut_extract(const char*sc);
+char const * flyx_shortcut_extract(char const * sc);
/// Make a shortnamed version of the above func
#define scex flyx_shortcut_extract
/// Extract shortcut from <ident>|<shortcut> string
-const char* flyx_ident_extract(char const *sc);
+char const * flyx_ident_extract(char const * sc);
/// Make a shortnamed versjon of the above func
#define idex flyx_ident_extract
string askForText(string const & msg, string const & dflt = string());
/// Informs the user that changes in the coming form will be ignored
-void WarnReadonly();
+void WarnReadonly(string const & file);
// inlined functions
/// rings the audio bell.
#else
-template<class A> inline void Assert(A /*assertion*/) {;}
+template<class A> inline void Assert(A /*assertion*/) {}
#endif /* ENABLE_ASSERTIONS */
string lowercase(string const & a)
{
-#if 0
- string tmp;
- string::const_iterator cit = a.begin();
- for(; cit != a.end(); ++cit) {
- tmp += static_cast<char>(tolower(*cit));
- }
- return tmp;
-#endif
string tmp(a);
transform(tmp.begin(), tmp.end(), tmp.begin(), tolower);
return tmp;
}
-#if 0
-string tostr(float f)
-{
- return tostr(double(f));
-}
-#endif
-
-
string tostr(double d)
{
// should use string stream
}
-int countChar(string const & a, char const c)
+unsigned int countChar(string const & a, char const c)
{
+#ifdef HAVE_STD_COUNT
return count(a.begin(), a.end(), c);
+#else
+ unsigned int n = 0;
+ count(a.begin(), a.end(), c, n);
+ return n;
+#endif
}
bool contains(char const * a, char const * b);
/// Counts how many of character c there is in a
-int countChar(string const & a, char const c);
+unsigned int countChar(string const & a, char const c);
/** Extracts a token from this string at the nth delim.
Doesn't modify the original string. Similar to strtok.
*
* LyX, The Document Processor
*
- * Copyright (C) 1995 Matthias Ettrich
- * Copyright (C) 1995-1999 The LyX Team.
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-1999 The LyX Team.
*
* ====================================================== */
/* This file is part of
-* ======================================================
-*
-* LyX, The Document Processor
-*
-* Copyright (C) 1995 Matthias Ettrich
-* Copyright (C) 1995-1998 The LyX Team.
-*
-* ====================================================== */
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-1999 The LyX Team.
+ *
+ * ====================================================== */
#include <config.h>
#include <cstdlib>
/* returns the minimum space a row needs on the screen in pixel */
-int LyXText::Fill(Row * row, int paperwidth)
+int LyXText::Fill(Row * row, int paper_width)
{
int w, fill;
/* get the pure distance */
}
}
- fill = paperwidth - w - RightMargin(row);
+ fill = paper_width - w - RightMargin(row);
return fill;
}
}
-void LyXText::RedoHeightOfParagraph(LyXCursor cursor)
+void LyXText::RedoHeightOfParagraph(LyXCursor cur)
{
- Row * tmprow = cursor.row;
- long y = cursor.y - tmprow->baseline;
+ Row * tmprow = cur.row;
+ long y = cur.y - tmprow->baseline;
SetHeightOfRow(tmprow);
LyXParagraph * first_phys_par = tmprow->par->FirstPhysicalPar();
status = LyXText::NEED_MORE_REFRESH;
refresh_y = y;
refresh_row = tmprow;
- SetCursor(cursor.par, cursor.pos);
+ SetCursor(cur.par, cur.pos);
}
-void LyXText::RedoDrawingOfParagraph(LyXCursor cursor)
+void LyXText::RedoDrawingOfParagraph(LyXCursor cur)
{
- Row * tmprow = cursor.row;
+ Row * tmprow = cur.row;
- long y = cursor.y - tmprow->baseline;
+ long y = cur.y - tmprow->baseline;
SetHeightOfRow(tmprow);
LyXParagraph * first_phys_par = tmprow->par->FirstPhysicalPar();
/* find the first row of the paragraph */
refresh_row = tmprow;
}
status = LyXText::NEED_MORE_REFRESH;
- SetCursor(cursor.par, cursor.pos);
+ SetCursor(cur.par, cur.pos);
}
/* deletes and inserts again all paragaphs between the cursor
* and the specified par
* This function is needed after SetLayout and SetFont etc. */
-void LyXText::RedoParagraphs(LyXCursor cursor, LyXParagraph * endpar)
+void LyXText::RedoParagraphs(LyXCursor cur, LyXParagraph * endpar)
{
Row * tmprow2;
LyXParagraph * tmppar, * first_phys_par;
- Row * tmprow = cursor.row;
+ Row * tmprow = cur.row;
- long y = cursor.y - tmprow->baseline;
+ long y = cur.y - tmprow->baseline;
if (!tmprow->previous){
first_phys_par = FirstParagraph(); // a trick/hack for UNDO
cursor.par->ParFromPos(cursor.pos)->next);
}
-void LyXText::RemoveTableRow(LyXCursor * cursor)
+void LyXText::RemoveTableRow(LyXCursor * cur)
{
- int
- cell_act,
- cell = -1,
- cell_org = 0,
- ocell = 0;
+ int cell = -1;
+ int cell_org = 0;
+ int ocell = 0;
/* move to the previous row */
- cell_act = NumberOfCell(cursor->par, cursor->pos);
+ int cell_act = NumberOfCell(cur->par, cur->pos);
if (cell < 0)
cell = cell_act;
- while (cursor->pos && !cursor->par->IsNewline(cursor->pos-1))
- cursor->pos--;
- while (cursor->pos &&
- !cursor->par->table->IsFirstCell(cell_act)){
- cursor->pos--;
- while (cursor->pos && !cursor->par->IsNewline(cursor->pos-1))
- cursor->pos--;
- cell--;
- cell_act--;
+ while (cur->pos && !cur->par->IsNewline(cur->pos - 1))
+ cur->pos--;
+ while (cur->pos &&
+ !cur->par->table->IsFirstCell(cell_act)) {
+ cur->pos--;
+ while (cur->pos && !cur->par->IsNewline(cur->pos - 1))
+ cur->pos--;
+ --cell;
+ --cell_act;
}
/* now we have to pay attention if the actual table is the
main row of TableContRows and if yes to delete all of them */
do {
ocell = cell;
/* delete up to the next row */
- while (cursor->pos < cursor->par->Last() &&
+ while (cur->pos < cur->par->Last() &&
(cell_act == ocell
- || !cursor->par->table->IsFirstCell(cell_act))){
- while (cursor->pos < cursor->par->Last() &&
- !cursor->par->IsNewline(cursor->pos))
- cursor->par->Erase(cursor->pos);
- cell++;
- cell_act++;
- if (cursor->pos < cursor->par->Last())
- cursor->par-> Erase(cursor->pos);
+ || !cur->par->table->IsFirstCell(cell_act))) {
+ while (cur->pos < cur->par->Last() &&
+ !cur->par->IsNewline(cur->pos))
+ cur->par->Erase(cur->pos);
+ ++cell;
+ ++cell_act;
+ if (cur->pos < cur->par->Last())
+ cur->par->Erase(cur->pos);
}
- if (cursor->pos && cursor->pos == cursor->par->Last()){
- cursor->pos--;
- cursor->par->Erase(cursor->pos); // no newline at the very end!
+ if (cur->pos && cur->pos == cur->par->Last()) {
+ cur->pos--;
+ cur->par->Erase(cur->pos); // no newline at the very end!
}
- } while (((cell+1) < cursor->par->table->GetNumberOfCells()) &&
- !cursor->par->table->IsContRow(cell_org) &&
- cursor->par->table->IsContRow(cell));
- cursor->par->table->DeleteRow(cell_org);
+ } while (((cell + 1) < cur->par->table->GetNumberOfCells()) &&
+ !cur->par->table->IsContRow(cell_org) &&
+ cur->par->table->IsContRow(cell));
+ cur->par->table->DeleteRow(cell_org);
return;
}
void Trans::InsertException(Trans::keyexc & exclist, char c,
string const & data, bool flag, tex_accent accent)
{
- keyexc p;
-
- p = new Keyexc;
+ keyexc p = new Keyexc;
p->next = exclist;
p->c = c;
break;
case KMAP: {
unsigned char key_from;
- char * string_to;
if (lyxerr.debugging(Debug::KBMAP))
lyxerr << "KMAP:\t" << lex.text() << endl;
if (lex.next(true)) {
- key_from= lex.text()[0];
+ key_from = lex.text()[0];
if (lyxerr.debugging(Debug::KBMAP))
lyxerr << "\t`" << lex.text() << "'"
<< endl;
if (lex.next(true)) {
char const * t = lex.text();
- string_to = strcpy(new char[strlen(t)+1], t);
+ char * string_to =
+ strcpy(new char[strlen(t)+1], t);
keymap_[key_from] = string_to;
if (lyxerr.debugging(Debug::KBMAP))
lyxerr << "\t`" << string_to << "'"
tex_accent accent;
string allowed;
KmodException exception_list;
-
-
- //KmodInfo(const KmodInfo&);
KmodInfo();
-
- //KmodInfo& operator= (const KmodInfo&);
};
#endif
// TransFSMData
TransFSMData::TransFSMData()
{
- deadkey_ = deadkey2_ = 0;
- deadkey_info_.accent = deadkey2_info_.accent = TEX_NOACCENT;
- comb_info_ = 0;
+ deadkey_ = deadkey2_ = 0;
+ deadkey_info_.accent = deadkey2_info_.accent = TEX_NOACCENT;
+ comb_info_ = 0;
}
// TransInitState
TransInitState::TransInitState()
{
- init_state_ = this;
+ init_state_ = this;
}
string TransInitState::normalkey(char c, char * t)
{
- string res;
- if (t != 0)
- res = t;
- else
- res = c;
+ string res;
+ if (t) res = t;
+ else res = c;
- return res;
+ return res;
}
string TransInitState::deadkey(char c, KmodInfo d)
{
- deadkey_ = c;
- deadkey_info_ = d;
- currentState = deadkey_state_;
- return string();
+ deadkey_ = c;
+ deadkey_info_ = d;
+ currentState = deadkey_state_;
+ return string();
}
// TransDeadkeyState
TransDeadkeyState::TransDeadkeyState()
{
- deadkey_state_ = this;
+ deadkey_state_ = this;
}
string TransDeadkeyState::normalkey(char c, char * trans)
{
- string res;
-
- // Check if it is an exception
- KmodException l = deadkey_info_.exception_list;
- while(l != 0) {
- if (l->c == c) {
- res = l->data;
- break;
+ string res;
+
+ // Check if it is an exception
+ KmodException l = deadkey_info_.exception_list;
+ while(l != 0) {
+ if (l->c == c) {
+ res = l->data;
+ break;
+ }
+ l = l->next;
}
- l = l->next;
- }
- if (l == 0) {
- // Not an exception. Check if it allowed
- if (current_view->buffer()->params.allowAccents == true ||
- countChar(deadkey_info_.allowed, c) > 0) {
- res = DoAccent(c, deadkey_info_.accent);
- } else {
- // Not allowed
- if (deadkey_!= 0)
- res = deadkey_;
- res+= TOKEN_SEP;
- res+= trans;
+ if (l == 0) {
+ // Not an exception. Check if it allowed
+ if (current_view->buffer()->params.allowAccents == true ||
+ countChar(deadkey_info_.allowed, c) > 0) {
+ res = DoAccent(c, deadkey_info_.accent);
+ } else {
+ // Not allowed
+ if (deadkey_!= 0)
+ res = deadkey_;
+ res+= TOKEN_SEP;
+ res+= trans;
+ }
}
- }
- currentState = init_state_;
- return res;
+ currentState = init_state_;
+ return res;
}
string TransDeadkeyState::deadkey(char c, KmodInfo d)
{
- string res;
-
- // Check if the same deadkey was typed twice
- if (deadkey_ == c) {
- res = deadkey_;
- deadkey_ = 0;
- deadkey_info_.accent = TEX_NOACCENT;
- currentState = init_state_;
- return res;
- }
-
- // Check if it is a combination or an exception
- KmodException l;
- l = deadkey_info_.exception_list;
-
- while(l) {
- if (l->combined == true && l->accent == d.accent) {
- deadkey2_ = c;
- deadkey2_info_ = d;
- comb_info_ = l;
- currentState = combined_state_;
- return string();
+ string res;
+
+ // Check if the same deadkey was typed twice
+ if (deadkey_ == c) {
+ res = deadkey_;
+ deadkey_ = 0;
+ deadkey_info_.accent = TEX_NOACCENT;
+ currentState = init_state_;
+ return res;
}
- if (l->c == c) {
- res = l->data;
- deadkey_ = 0;
- deadkey_info_.accent = TEX_NOACCENT;
- currentState = init_state_;
- return res;
+
+ // Check if it is a combination or an exception
+ KmodException l;
+ l = deadkey_info_.exception_list;
+
+ while(l) {
+ if (l->combined == true && l->accent == d.accent) {
+ deadkey2_ = c;
+ deadkey2_info_ = d;
+ comb_info_ = l;
+ currentState = combined_state_;
+ return string();
+ }
+ if (l->c == c) {
+ res = l->data;
+ deadkey_ = 0;
+ deadkey_info_.accent = TEX_NOACCENT;
+ currentState = init_state_;
+ return res;
+ }
+ l = l->next;
}
- l = l->next;
- }
-
- // Not a combination or an exception.
- // Output deadkey1 and keep deadkey2
-
- if (deadkey_!= 0)
- res = deadkey_;
- deadkey_ = c;
- deadkey_info_ = d;
- currentState = deadkey_state_;
- return res;
+ // Not a combination or an exception.
+ // Output deadkey1 and keep deadkey2
+
+ if (deadkey_!= 0)
+ res = deadkey_;
+ deadkey_ = c;
+ deadkey_info_ = d;
+ currentState = deadkey_state_;
+ return res;
}
TransCombinedState::TransCombinedState()
{
- combined_state_ = this;
+ combined_state_ = this;
}
-string TransCombinedState::normalkey(char c, char *trans)
+string TransCombinedState::normalkey(char c, char * trans)
{
- string res;
-
- // Check if the key is allowed on the combination
- if (countChar(comb_info_->data, c) > 0) {
- string temp;
- temp = DoAccent(c, deadkey2_info_.accent);
- res = DoAccent(temp, deadkey_info_.accent);
- currentState = init_state_;
- } else {
- // Not allowed. Output deadkey1 and check deadkey2 + c
- if (deadkey_!= 0)
- res+= deadkey_;
- res+= TOKEN_SEP;
- deadkey_ = deadkey2_;
- deadkey_info_ = deadkey2_info_;
- // Call deadkey state and leave it to setup the FSM
- res+= deadkey_state_->normalkey(c, trans);
- }
- return res;
+ string res;
+
+ // Check if the key is allowed on the combination
+ if (countChar(comb_info_->data, c) > 0) {
+ string temp;
+ temp = DoAccent(c, deadkey2_info_.accent);
+ res = DoAccent(temp, deadkey_info_.accent);
+ currentState = init_state_;
+ } else {
+ // Not allowed. Output deadkey1 and check deadkey2 + c
+ if (deadkey_ != 0)
+ res += deadkey_;
+ res += TOKEN_SEP;
+ deadkey_ = deadkey2_;
+ deadkey_info_ = deadkey2_info_;
+ // Call deadkey state and leave it to setup the FSM
+ res += deadkey_state_->normalkey(c, trans);
+ }
+ return res;
}
string TransCombinedState::deadkey(char c, KmodInfo d)
{
- // Third key in a row. Output the first one and
- // reenter with shifted deadkeys
- string res;
- if (deadkey_ != 0)
- res = deadkey_;
- res += TOKEN_SEP;
- deadkey_ = deadkey2_;
- deadkey_info_ = deadkey2_info_;
- res += deadkey_state_->deadkey(c, d);
- return res;
+ // Third key in a row. Output the first one and
+ // reenter with shifted deadkeys
+ string res;
+ if (deadkey_ != 0)
+ res = deadkey_;
+ res += TOKEN_SEP;
+ deadkey_ = deadkey2_;
+ deadkey_info_ = deadkey2_info_;
+ res += deadkey_state_->deadkey(c, d);
+ return res;
}
// TransFSM
TransFSM::TransFSM():
- TransFSMData(),
- TransInitState(),
- TransDeadkeyState(),
- TransCombinedState()
+ TransFSMData(),
+ TransInitState(),
+ TransDeadkeyState(),
+ TransCombinedState()
{
- currentState = init_state_;
+ currentState = init_state_;
}
// TransManager
-
+
TransManager::TransManager()
: active_(0), t1_(new Trans), t2_(new Trans)
{}
TransManager::~TransManager()
{
- delete t1_;
- delete t2_;
+ delete t1_;
+ delete t2_;
}
int TransManager::SetPrimary(string const & language)
{
- if (t1_->GetName() == language)
- return 0;
+ if (t1_->GetName() == language)
+ return 0;
- return t1_->Load(language);
+ return t1_->Load(language);
}
int TransManager::SetSecondary(string const & language)
{
- if (t2_->GetName() == language)
- return 0;
+ if (t2_->GetName() == language)
+ return 0;
- return t2_->Load(language);
+ return t2_->Load(language);
}
bool TransManager::setCharset(char const * set)
{
- return chset_.loadFile(set);
+ return chset_.loadFile(set);
}
void TransManager::EnablePrimary()
{
- if (t1_->IsDefined())
- active_ = t1_;
-
- lyxerr[Debug::KBMAP] << "Enabling primary keymap" << endl;
+ if (t1_->IsDefined())
+ active_ = t1_;
+
+ lyxerr[Debug::KBMAP] << "Enabling primary keymap" << endl;
}
void TransManager::EnableSecondary()
{
- if (t2_->IsDefined( ))
- active_ = t2_;
- lyxerr[Debug::KBMAP] << "Enabling secondary keymap" << endl;
+ if (t2_->IsDefined())
+ active_ = t2_;
+ lyxerr[Debug::KBMAP] << "Enabling secondary keymap" << endl;
}
void TransManager::DisableKeymap()
{
- active_ = default_;
- lyxerr[Debug::KBMAP] << "Disabling keymap" << endl;
+ active_ = default_;
+ lyxerr[Debug::KBMAP] << "Disabling keymap" << endl;
}
void TransManager::TranslateAndInsert(char c, LyXText * text)
{
- string res = active_->process(c, *this);
-
- // Process with tokens
- string temp;
+ string res = active_->process(c, *this);
+
+ // Process with tokens
+ string temp;
- while(res.length() > 0) {
- res = split(res, temp, TransState::TOKEN_SEP);
- insert(temp, text);
- }
+ while(res.length() > 0) {
+ res = split(res, temp, TransState::TOKEN_SEP);
+ insert(temp, text);
+ }
}
void TransManager::insertVerbatim(string const & str, LyXText * text)
{
- int l = str.length();
+ int l = str.length();
- for (int i = 0; i < l; ++i){
- if (str[i] == '\"'
- && text->GetFont(text->cursor.par,
- text->cursor.pos).latex() == LyXFont::OFF)
- InsertCorrectQuote();
- else
- text->InsertChar(str[i]);
- }
+ for (int i = 0; i < l; ++i){
+ if (str[i] == '\"'
+ && text->GetFont(text->cursor.par,
+ text->cursor.pos).latex() == LyXFont::OFF)
+ InsertCorrectQuote();
+ else
+ text->InsertChar(str[i]);
+ }
}
// Go through the character encoding only if the current
// encoding (chset_->name()) matches the current font_norm
// (lyrxc->font_norm
-
+
// Is false to speak about "only if" the current encoding will
// almost always be equal to font_norm.
pair<bool, int> enc = chset_.encodeString(str);
void TransManager::deadkey(char c, tex_accent accent, LyXText * t)
{
- KmodInfo i;
- string res;
-
- if (c == 0 && active_ != default_) {
- // A deadkey was pressed that cannot be printed
- // or a accent command was typed in the minibuffer
-
- if (active_->isAccentDefined(accent, i) == true) {
- res = trans_fsm_.currentState->deadkey(c, i);
- insert(res, t);
- return;
+ if (c == 0 && active_ != default_) {
+ // A deadkey was pressed that cannot be printed
+ // or a accent command was typed in the minibuffer
+ KmodInfo i;
+ if (active_->isAccentDefined(accent, i) == true) {
+ string res = trans_fsm_.currentState->deadkey(c, i);
+ insert(res, t);
+ return;
+ }
}
- }
-
- if (active_ == default_ || c == 0) {
- i.accent = accent;
- i.allowed = lyx_accent_table[accent].native;
- i.data.clear();
- i.exception_list = 0;
- string res = trans_fsm_.currentState->deadkey(c, i);
- insert(res, t);
- } else {
- // Go through the translation
- TranslateAndInsert(c, t);
- }
+ if (active_ == default_ || c == 0) {
+ KmodInfo i;
+ i.accent = accent;
+ i.allowed = lyx_accent_table[accent].native;
+ i.data.clear();
+ i.exception_list = 0;
+
+ string res = trans_fsm_.currentState->deadkey(c, i);
+ insert(res, t);
+ } else {
+ // Go through the translation
+ TranslateAndInsert(c, t);
+ }
}
/// Init State
-class TransInitState:
+class TransInitState :
virtual public TransFSMData,
public TransState {
public:
- ///
- TransInitState();
- ///
- virtual string normalkey(char, char *);
- ///
- virtual bool backspace() { return true; }
- ///
- virtual string deadkey(char, KmodInfo);
+ ///
+ TransInitState();
+ ///
+ virtual string normalkey(char, char *);
+ ///
+ virtual bool backspace() { return true; }
+ ///
+ virtual string deadkey(char, KmodInfo);
};
/// Deadkey State
-class TransDeadkeyState:
+class TransDeadkeyState :
virtual public TransFSMData,
public TransState {
public:
- ///
- TransDeadkeyState();
- ///
- virtual string normalkey(char, char *);
- ///
- virtual bool backspace()
- {
+ ///
+ TransDeadkeyState();
+ ///
+ virtual string normalkey(char, char *);
+ ///
+ virtual bool backspace() {
currentState = init_state_;
return false;
}
- ///
- virtual string deadkey(char, KmodInfo);
+ ///
+ virtual string deadkey(char, KmodInfo);
};
virtual public TransFSMData,
public TransState {
public:
- ///
- TransCombinedState();
- ///
- virtual string normalkey(char, char *);
- ///
- virtual bool backspace()
- {
+ ///
+ TransCombinedState();
+ ///
+ virtual string normalkey(char, char *);
+ ///
+ virtual bool backspace() {
// cancel the second deadkey
deadkey2_ = 0;
deadkey2_info_.accent = TEX_NOACCENT;
return false;
}
- ///
- virtual string deadkey(char, KmodInfo);
+ ///
+ virtual string deadkey(char, KmodInfo);
};
///
-class TransFSM:
+class TransFSM :
virtual public TransFSMData,
public TransInitState,
public TransDeadkeyState,
TransFSM();
};
+
///
-class TransManager
-{
+class TransManager {
private:
///
TransFSM trans_fsm_;
///
bool setCharset(const char *);
///
- bool backspace()
- {
+ bool backspace() {
return trans_fsm_.currentState->backspace();
}
///