Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

lyx_gui Namespace Reference

GUI interaction. More...


Functions

string const roman_font_name ()
 return a suitable serif font name (called from non-gui context too !). More...

string const sans_font_name ()
 return a suitable sans serif font name (called from non-gui context too !). More...

string const typewriter_font_name ()
 return a suitable monospaced font name (called from non-gui context too !). More...

void parse_init (int &argc, char *argv[])
 parse command line and do basic initialisation. More...

void parse_lyxrc ()
 set up GUI parameters. More...

void start (string const &batch, std::vector< string > const &files)
 Start the main event loop, after executing the given batch commands, and loading the given documents. More...

void sync_events ()
 Synchronise all pending events. More...

void exit ()
 quit running LyX. More...

FuncStatus getStatus (FuncRequest const &ev)
 return the status flag for a given action. More...

string const hexname (LColor::color col)
 Eg, passing LColor::black returns "000000", passing LColor::white returns "ffffff". More...

void update_color (LColor::color col)
 update an altered GUI color. More...

void update_fonts ()
 update the font cache. More...

bool font_available (LyXFont const &font)
 is the given font available ? More...

void set_read_callback (int fd, LyXComm *comm)
 add a callback for I/O read notification. More...

void remove_read_callback (int fd)
 remove a I/O read callback. More...

void C_read_callback (int, void *data)

Variables

bool use_gui = true
 are we using the GUI at all. More...


Detailed Description

GUI interaction.

Function Documentation

void C_read_callback int   ,
void *    data
[static]
 

Definition at line 373 of file xforms/lyx_gui.C.

00374 {
00375         LyXComm * comm = static_cast<LyXComm *>(data);
00376         comm->read_ready();
00377 }

void lyx_gui::exit  
 

quit running LyX.

Definition at line 178 of file qt2/lyx_gui.C.

Referenced by error_handler, LyX::init, LyX::LyX, LyXSetStyle, parse_dbg, parse_execute, parse_export, parse_help, parse_import, parse_sysdir, parse_userdir, parse_version, QuitLyX, and showFileError.

00179 {
00180         delete lyxserver;
00181         lyxserver = 0;
00182 
00183         // we cannot call qApp->exit(0) - that could return us
00184         // into a static dialog return in the lyx code (for example,
00185         // load autosave file QMessageBox. We have to just get the hell
00186         // out.
00187 
00188         ::exit(0);
00189 }

bool lyx_gui::font_available LyXFont const &    font
 

is the given font available ?

Definition at line 229 of file qt2/lyx_gui.C.

Referenced by augmentFont, and math_font_available.

00230 {
00231         return fontloader.available(font);
00232 }

FuncStatus lyx_gui::getStatus FuncRequest const &    ev
 

return the status flag for a given action.

This can be used to tell that a given lfun is not implemented by a frontend

Definition at line 192 of file qt2/lyx_gui.C.

Referenced by LyXFunc::getStatus.

00193 {
00194         FuncStatus flag;
00195         switch (ev.action) {
00196         case LFUN_DIALOG_SHOW:
00197                 if (ev.argument == "preamble" || ev.argument == "forks")
00198                         flag.unknown(true);
00199                 break;
00200         case LFUN_TOOLTIPS_TOGGLE:
00201                 flag.unknown(true);
00202                 break;
00203         default:
00204                 break;
00205         }
00206         return flag;
00207 }

string const lyx_gui::hexname LColor::color    col
 

Eg, passing LColor::black returns "000000", passing LColor::white returns "ffffff".

Definition at line 210 of file qt2/lyx_gui.C.

Referenced by FormPreferences::Colors::apply, lyx::graphics::PreviewLoader::Impl::dumpPreamble, and FormPreferences::Colors::LoadBrowserLyX.

00211 {
00212         return ltrim(fromqstr(lcolorcache.get(col).name()), "#");
00213 }

void lyx_gui::parse_init int &    argc,
char *    argv[]
 

parse command line and do basic initialisation.

Definition at line 118 of file qt2/lyx_gui.C.

Referenced by LyX::LyX.

00119 {
00120         static LQApplication a(argc, argv);
00121 
00122         using namespace lyx::graphics;
00123 
00124         Image::newImage = boost::bind(&QLImage::newImage);
00125         Image::loadableFormats = boost::bind(&QLImage::loadableFormats);
00126 
00127         // needs to be done before reading lyxrc
00128         lyxrc.dpi = getDPI();
00129 
00130         initEncodings();
00131 
00132         LoaderQueue::setPriority(10,100);
00133 }

void lyx_gui::parse_lyxrc  
 

set up GUI parameters.

At this point lyxrc may be used.

Definition at line 136 of file qt2/lyx_gui.C.

Referenced by LyX::LyX.

00137 {}

void lyx_gui::remove_read_callback int    fd
 

remove a I/O read callback.

Parameters:
fd  file descriptor

Definition at line 241 of file qt2/lyx_gui.C.

Referenced by LyXComm::endPipe.

00242 {
00243         map<int, io_callback *>::iterator it = io_callbacks.find(fd);
00244         if (it != io_callbacks.end()) {
00245                 delete it->second;
00246                 io_callbacks.erase(it);
00247         }
00248 }

string const lyx_gui::roman_font_name  
 

return a suitable serif font name (called from non-gui context too !).

Definition at line 251 of file qt2/lyx_gui.C.

Referenced by LyX::init, and setComboxFont.

00252 {
00253         if (!use_gui)
00254                 return "serif";
00255 
00256         QFont font;
00257         font.setStyleHint(QFont::Serif);
00258         font.setFamily("serif");
00259         return QFontInfo(font).family().latin1();
00260 }

string const lyx_gui::sans_font_name  
 

return a suitable sans serif font name (called from non-gui context too !).

Definition at line 263 of file qt2/lyx_gui.C.

Referenced by LyX::init, and setComboxFont.

00264 {
00265         if (!use_gui)
00266                 return "sans";
00267 
00268         QFont font;
00269         font.setStyleHint(QFont::SansSerif);
00270         font.setFamily("sans");
00271         return QFontInfo(font).family().latin1();
00272 }

void lyx_gui::set_read_callback int    fd,
LyXComm   comm
 

add a callback for I/O read notification.

Definition at line 235 of file qt2/lyx_gui.C.

Referenced by LyXComm::startPipe.

00236 {
00237         io_callbacks[fd] = new io_callback(fd, comm);
00238 }

void lyx_gui::start string const &    batch,
std::vector< string > const &    files
 

Start the main event loop, after executing the given batch commands, and loading the given documents.

Definition at line 140 of file qt2/lyx_gui.C.

Referenced by Paragraph::Pimpl::acceptChange, Paragraph::acceptChange, LyXText::changeDepth, LyXText::dispatch, Paragraph::Pimpl::erase, Paragraph::erase, QCitationDialog::find, FormCitation::findBiblio, InsetTabular::getSelection, Changes::isChange, Paragraph::Pimpl::isChanged, Paragraph::isChanged, Paragraph::Pimpl::isChangeEdited, Paragraph::isChangeEdited, Changes::isChangeEdited, Changes::latexMarkChange, InsetTabular::localDispatch, RowPainter::paintChangeBar, RowPainter::paintLengthMarker, Parser::parse1, Paragraph::Pimpl::rejectChange, Paragraph::rejectChange, Changes::set, and InsetTabular::setSelection.

00141 {
00142         // initial geometry
00143         unsigned int width = 690;
00144         unsigned int height = 510;
00145 
00146         QtView view(width, height);
00147         view.show();
00148         view.init();
00149 
00150         // FIXME: some code below needs moving
00151 
00152         lyxserver = new LyXServer(&view.getLyXFunc(), lyxrc.lyxpipes);
00153 
00154         vector<string>::const_iterator cit = files.begin();
00155         vector<string>::const_iterator end = files.end();
00156         for (; cit != end; ++cit)
00157                 view.view()->loadLyXFile(*cit, true);
00158 
00159         // handle the batch commands the user asked for
00160         if (!batch.empty()) {
00161                 view.getLyXFunc().dispatch(batch);
00162         }
00163 
00164         qApp->exec();
00165 
00166         // FIXME
00167         delete lyxserver;
00168         lyxserver = 0;
00169 }

void lyx_gui::sync_events  
 

Synchronise all pending events.

Definition at line 172 of file qt2/lyx_gui.C.

Referenced by LyXScreen::showCursor.

00173 {
00174         qApp->processEvents();
00175 }

string const lyx_gui::typewriter_font_name  
 

return a suitable monospaced font name (called from non-gui context too !).

Definition at line 275 of file qt2/lyx_gui.C.

Referenced by LyX::init, and setComboxFont.

00276 {
00277         if (!use_gui)
00278                 return "monospace";
00279 
00280         QFont font;
00281         font.setStyleHint(QFont::TypeWriter);
00282         font.setFamily("monospace");
00283         return QFontInfo(font).family().latin1();
00284 }

void lyx_gui::update_color LColor::color    col
 

update an altered GUI color.

Definition at line 216 of file qt2/lyx_gui.C.

Referenced by LyXFunc::dispatch.

00217 {
00218         // FIXME: Bleh, can't we just clear them all at once ?
00219         lcolorcache.clear();
00220 }

void lyx_gui::update_fonts  
 

update the font cache.

Definition at line 223 of file qt2/lyx_gui.C.

Referenced by LyXFunc::dispatch.

00224 {
00225         fontloader.update();
00226 }


Variable Documentation

bool lyx_gui::use_gui = true
 

are we using the GUI at all.

Definition at line 136 of file xforms/lyx_gui.C.


Generated on Fri Jul 18 01:19:11 2003 for lyx by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002