Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes | Protected Attributes | Private Attributes | Static Private Attributes | Friends
qt_printer_widget_rep Class Reference

This implements a printer widget, using QTMPrinterDialog. More...

#include <qt_printer_widget.hpp>

Inheritance diagram for qt_printer_widget_rep:
Inheritance graph
[legend]
Collaboration diagram for qt_printer_widget_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 qt_printer_widget_rep (command, url)
 ~qt_printer_widget_rep ()
virtual void send (slot s, blackbox val)
widget plain_window_widget (string s, command q)
 Return the widget as a top-level window to the eyes of TeXmacs.
void showDialog ()
 Shows the printer dialog.
virtual widget make_popup_widget ()
virtual widget popup_window_widget (string s)
virtual QAction * as_qaction ()
virtual QWidget * as_qwidget ()
 Returns the actual QWidget wrapped by this qt_widget_rep.
virtual QMenu * get_qmenu ()
 This method must not give ownership of the menu to the caller, thus allowing menu caching at the TeXmacs level.
virtual QWidget * get_canvas ()
 Get a texmacs canvas (if available).
virtual QLayoutItem * as_qlayoutitem ()
 Returns a QLayoutItem...
virtual tm_ostreamprint (tm_ostream &out)
virtual blackbox query (slot s, int type_id)
virtual widget read (slot s, blackbox index)
virtual void write (slot s, blackbox index, widget w)
virtual void notify (slot s, blackbox new_val)
virtual void connect (slot s, widget w2, slot s2)
virtual void deconnect (slot s, widget w2, slot s2)

Public Attributes

int ref_count

Protected Attributes

list< widget_connectionin
list< widget_connectionout

Private Attributes

command commandAfterExecution

Static Private Attributes

static QTMPrinterSettings_settings = NULL

Friends

class widget

Detailed Description

This implements a printer widget, using QTMPrinterDialog.

The "factory" function for this widget is called printer_widget(), in qt_dialogues.cpp

All printing options set by the user at this stage are applied as a postprocessing of an already typeset postscript document. Either we instruct the printing system to print specific pages, etc., or we take the Postscript file generated by TeXmacs and create a new temporary one applying the options set by the user in the print dialog and then send this new file to the printer.

See also:
qt_printer_widget_rep::showDialog()

Definition at line 34 of file qt_printer_widget.hpp.


Constructor & Destructor Documentation

Todo:
Load the default printer settings from somewhere.

Definition at line 26 of file qt_printer_widget.cpp.

: commandAfterExecution(_cmd) {
#if defined(Q_WS_MAC) || defined(Q_WS_X11)
  if (!_settings)
    _settings = new CupsQTMPrinterSettings();
#endif
#ifdef Q_WS_WIN
  if (!_settings)
    _settings = new WinQTMPrinterSettings();
#endif
  _settings->fileName = to_qstring(as_string(_file));
}

Here is the call graph for this function:

Definition at line 37 of file qt_printer_widget.hpp.

{ };

Member Function Documentation

QAction * qt_widget_rep::as_qaction ( ) [virtual, inherited]

Reimplemented in qt_glue_widget_rep, qt_ui_element_rep, simple_widget_rep, qt_menu_rep, and qt_input_text_widget_rep.

Definition at line 106 of file qt_menu.cpp.

                                   {
  QAction *a = new QTMAction (NULL); 
  //  a->setSeparator(true);
  a->setEnabled(false);
  return a;
};
virtual QLayoutItem* qt_widget_rep::as_qlayoutitem ( ) [inline, virtual, inherited]

Returns a QLayoutItem...

Reimplemented in qt_ui_element_rep, and qt_input_text_widget_rep.

Definition at line 84 of file qt_widget.hpp.

{ return NULL; }
virtual QWidget* qt_widget_rep::as_qwidget ( ) [inline, virtual, inherited]

Returns the actual QWidget wrapped by this qt_widget_rep.

This is used to connect to signals, to change properties of the QWidget, etc.

Reimplemented in qt_glue_widget_rep, qt_ui_element_rep, qt_view_widget_rep, and qt_input_text_widget_rep.

Definition at line 66 of file qt_widget.hpp.

{ return NULL; }
void widget_rep::connect ( slot  s,
widget  w2,
slot  s2 
) [virtual, inherited]

Definition at line 150 of file widget.cpp.

                                               {
  widget_connection con (this, s, w2.rep, s2);
  insert (out, con);
  insert (w2->in, con);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void widget_rep::deconnect ( slot  s,
widget  w2,
slot  s2 
) [virtual, inherited]

Definition at line 157 of file widget.cpp.

                                                 {
  widget_connection con (this, s, w2.rep, s2);
  remove (out, con);
  remove (w2->in, con);
}
virtual QWidget* qt_widget_rep::get_canvas ( ) [inline, virtual, inherited]

Get a texmacs canvas (if available).

Reimplemented in simple_widget_rep.

Definition at line 80 of file qt_widget.hpp.

{ return NULL; }
virtual QMenu* qt_widget_rep::get_qmenu ( ) [inline, virtual, inherited]

This method must not give ownership of the menu to the caller, thus allowing menu caching at the TeXmacs level.

Called only by code which attaches root menus in the GUI elements.

Reimplemented in qt_ui_element_rep, and qt_menu_rep.

Definition at line 74 of file qt_widget.hpp.

{ return NULL; }
widget qt_widget_rep::make_popup_widget ( ) [virtual, inherited]

Reimplemented in qt_ui_element_rep, and qt_menu_rep.

Definition at line 34 of file qt_widget.cpp.

                                  {
  return this;
}
void widget_rep::notify ( slot  s,
blackbox  new_val 
) [virtual, inherited]

Reimplemented in aqua_input_widget_rep, aqua_chooser_widget_rep, qt_window_widget_rep, aqua_view_widget_rep, aqua_chooser_widget_rep, qt_input_widget_rep, qt_chooser_widget_rep, simple_widget_rep, simple_widget_rep, qt_view_widget_rep, wk_widget_rep, and qt_window_widget_rep.

Definition at line 194 of file widget.cpp.

                                            {
  list<widget_connection> l= out;
  while (!is_nil (l)) {
    l->item->w2->send (s, new_val);
    l= l->next;
  }  
}

Here is the call graph for this function:

Return the widget as a top-level window to the eyes of TeXmacs.

Reimplemented from qt_widget_rep.

Definition at line 66 of file qt_printer_widget.cpp.

{
  // Identify ourselves as already being a top-level window, even though
  // the dialog won't be displayed until later.
  //view->setProperty ("texmacs_window_widget",
  //                 QVariant::fromValue ((void*) this));
  (void) s;
  commandAfterExecution = q;

  return this;
}
widget qt_widget_rep::popup_window_widget ( string  s) [virtual, inherited]

Reimplemented in qt_ui_element_rep, and qt_menu_rep.

Definition at line 39 of file qt_widget.cpp.

                                            {
  (void) s;
  return widget ();
}
tm_ostream & widget_rep::print ( tm_ostream out) [virtual, inherited]

Reimplemented in wk_widget_rep.

Definition at line 207 of file widget.cpp.

                                  {
  return out << "widget";
}
blackbox widget_rep::query ( slot  s,
int  type_id 
) [virtual, inherited]
widget widget_rep::read ( slot  s,
blackbox  index 
) [virtual, inherited]
void qt_printer_widget_rep::send ( slot  s,
blackbox  val 
) [virtual]

Reimplemented from widget_rep.

Definition at line 45 of file qt_printer_widget.cpp.

                                                 {
  if (DEBUG_QT)
    cout << "qt_printer_widget_rep::send " << slot_name(s) << LF;
  switch (s) {
    case SLOT_VISIBILITY:   // Activates the widget
      TYPE_CHECK (type_box (val) == type_helper<bool>::id);
      if (open_box<bool>(val) == true)
        showDialog();
      break;
    case SLOT_REFRESH:   // ignore: this widget doesn't need refreshing.
      break;
    default:  // unsupported slots
      qt_widget_rep::send (s, val);  // throws FAILED()
      break;
  }
}

Here is the call graph for this function:

Shows the printer dialog.

The native ones have more options than we can handle so we don't use them. Executing the scheme closure at the end crashes TeXmacs upon exit! Looks like someone is trying to delete the command twice?

Definition at line 87 of file qt_printer_widget.cpp.

                                   {
  
  QString _cmd;
  QTMPrintDialog pDialog(_settings);
  
  if (pDialog.exec() != QDialog::Accepted)
    return; // TODO: display message in the status bar.
  
  _cmd = _settings->toSystemCommand();
  
  // Send the document to the printer
  cout << "qt_printer_dialog_rep] Running command: " << from_qstring(_cmd) 
       << "\n";
  qt_system(from_qstring(_cmd));  // FIXME? qt_system is synchronous (blocking!)
  
  // execute the scheme closure 
  commandAfterExecution ();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void widget_rep::write ( slot  s,
blackbox  index,
widget  w 
) [virtual, inherited]

Friends And Related Function Documentation

friend class widget [friend, inherited]

Definition at line 59 of file widget.hpp.


Member Data Documentation

Definition at line 45 of file qt_printer_widget.hpp.

Definition at line 46 of file qt_printer_widget.hpp.

list<widget_connection> widget_rep::in [protected, inherited]

Definition at line 36 of file widget.hpp.

list<widget_connection> widget_rep::out [protected, inherited]

Definition at line 37 of file widget.hpp.

int abstract_struct::ref_count [inherited]

Definition at line 142 of file basic.hpp.


The documentation for this class was generated from the following files: