"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Plugins/Qt/qt_gui.cpp" between
TeXmacs-1.99.4-src.tar.gz and TeXmacs-1.99.5-src.tar.gz

About: GNU TeXmacs is a what-you-see-is-what-you-get scientific text editor, which was both inspired by TeX and GNU Emacs.

qt_gui.cpp  (TeXmacs-1.99.4-src):qt_gui.cpp  (TeXmacs-1.99.5-src)
skipping to change at line 47 skipping to change at line 47
#include <QSocketNotifier> #include <QSocketNotifier>
#include <QSetIterator> #include <QSetIterator>
#include <QTranslator> #include <QTranslator>
#include <QLocale> #include <QLocale>
#include <QMimeData> #include <QMimeData>
#include <QByteArray> #include <QByteArray>
#include <QCoreApplication> #include <QCoreApplication>
#include <QLibraryInfo> #include <QLibraryInfo>
#include <QImage> #include <QImage>
#include <QUrl> #include <QUrl>
#include <QDesktopWidget>
#include "QTMGuiHelper.hpp" #include "QTMGuiHelper.hpp"
#include "QTMWidget.hpp" #include "QTMWidget.hpp"
#include "QTMWindow.hpp" #include "QTMWindow.hpp"
#include "QTMApplication.hpp" #include "QTMApplication.hpp"
#ifdef MACOSX_EXTENSIONS #ifdef MACOSX_EXTENSIONS
#include "MacOS/mac_utilities.h" #include "MacOS/mac_utilities.h"
#endif #endif
skipping to change at line 122 skipping to change at line 123
mac_install_filter(); mac_install_filter();
#endif #endif
set_output_language (get_locale_language ()); set_output_language (get_locale_language ());
refresh_language(); refresh_language();
updatetimer = new QTimer (gui_helper); updatetimer = new QTimer (gui_helper);
updatetimer->setSingleShot (true); updatetimer->setSingleShot (true);
QObject::connect (updatetimer, SIGNAL (timeout()), QObject::connect (updatetimer, SIGNAL (timeout()),
gui_helper, SLOT (doUpdate())); gui_helper, SLOT (doUpdate()));
// (void) default_font (); // (void) default_font ();
if (!retina_manual) {
retina_manual= true;
#ifdef MACOSX_EXTENSIONS
double mac_hidpi = mac_screen_scale_factor();
if (DEBUG_STD)
debug_boot << "Mac Screen scaleFfactor: " << mac_hidpi << "\n";
if (mac_hidpi == 2) {
if (DEBUG_STD) debug_boot << "Setting up HiDPI mode\n";
retina_factor= 2;
if (!retina_iman) {
retina_iman = true;
retina_icons = 1;
// retina_icons = 2; // FIXME: why is this not better?
}
retina_scale = 1.4;
}
#else
/*
SI w, h;
get_extents (w, h);
if (DEBUG_STD)
debug_boot << "Screen extents: " << w/PIXEL << " x " << h/PIXEL << "\n";
if (w >= 2304*PIXEL) {
retina_factor= 2;
retina_scale = 1.4;
}
*/
#endif
}
} }
/* important routines */ /* important routines */
void void
qt_gui_rep::get_extents (SI& width, SI& height) { qt_gui_rep::get_extents (SI& width, SI& height) {
coord2 size = from_qsize (QApplication::desktop()->size()); coord2 size = from_qsize (QApplication::desktop()->size());
width = size.x1; width = size.x1;
height = size.x2; height = size.x2;
} }
skipping to change at line 276 skipping to change at line 308
QClipboard *cb = QApplication::clipboard (); QClipboard *cb = QApplication::clipboard ();
QClipboard::Mode mode = QClipboard::Clipboard; QClipboard::Mode mode = QClipboard::Clipboard;
if (key == "primary"); if (key == "primary");
else if (key == "mouse" && cb->supportsSelection()) else if (key == "mouse" && cb->supportsSelection())
mode = QClipboard::Selection; mode = QClipboard::Selection;
else return true; else return true;
cb->clear (mode); cb->clear (mode);
c_string selection (s); c_string selection (s);
cb->setText (QString::fromAscii (selection), mode); cb->setText (QString::fromLatin1 (selection), mode);
QMimeData *md = new QMimeData; QMimeData *md = new QMimeData;
if (format == "verbatim" || format == "default") { if (format == "verbatim" || format == "default") {
if (format == "default") { if (format == "default") {
md->setData ("application/x-texmacs-clipboard", (char*)selection); md->setData ("application/x-texmacs-clipboard", (char*)selection);
QString pid_str; QString pid_str;
pid_str.setNum (QCoreApplication::applicationPid ()); pid_str.setNum (QCoreApplication::applicationPid ());
md->setData ("application/x-texmacs-pid", pid_str.toAscii()); md->setData ("application/x-texmacs-pid", pid_str.toLatin1());
(void) sh; (void) sh;
//selection = c_string (sh); //selection = c_string (sh);
//md->setHtml (selection); //md->setHtml (selection);
//tm_delete_array (selection); //tm_delete_array (selection);
selection = c_string (sv); selection = c_string (sv);
} }
string enc = get_preference ("texmacs->verbatim:encoding"); string enc = get_preference ("texmacs->verbatim:encoding");
if (enc == "auto") if (enc == "auto")
enc = get_locale_charset (); enc = get_locale_charset ();
if (enc == "utf-8" || enc == "UTF-8") if (enc == "utf-8" || enc == "UTF-8")
md->setText (QString::fromUtf8 (selection)); md->setText (QString::fromUtf8 (selection));
else if (enc == "iso-8859-1" || enc == "ISO-8859-1") else if (enc == "iso-8859-1" || enc == "ISO-8859-1")
md->setText (QString::fromLatin1 (selection)); md->setText (QString::fromLatin1 (selection));
else else
md->setText (QString::fromAscii (selection)); md->setText (QString::fromLatin1 (selection));
} }
else else
md->setText (QString::fromAscii (selection)); md->setText (QString::fromLatin1 (selection));
cb->setMimeData (md, mode); cb->setMimeData (md, mode);
// according to the docs, ownership of mimedata is transferred to clipboard // according to the docs, ownership of mimedata is transferred to clipboard
// so no memory leak here // so no memory leak here
return true; return true;
} }
void void
qt_gui_rep::clear_selection (string key) { qt_gui_rep::clear_selection (string key) {
selection_t->reset (key); selection_t->reset (key);
selection_s->reset (key); selection_s->reset (key);
skipping to change at line 748 skipping to change at line 780
process_queued_events (1); process_queued_events (1);
count_events++; count_events++;
if (the_interpose_handler) the_interpose_handler(); if (the_interpose_handler) the_interpose_handler();
} }
// Repaint invalid regions and redraw // Repaint invalid regions and redraw
count_events = 0; count_events = 0;
interrupted = false; interrupted = false;
timeout_time = texmacs_time() + time_credit; timeout_time = texmacs_time() + time_credit;
QSetIterator<QTMWidget*> i (QTMWidget::all_widgets); qt_simple_widget_rep::repaint_all ();
while (i.hasNext()) {
QTMWidget* w = i.next();
if (w->isVisible()) w->repaint_invalid_regions();
}
if (waiting_events.size() > 0) needing_update = true; if (waiting_events.size() > 0) needing_update = true;
if (interrupted) needing_update = true; if (interrupted) needing_update = true;
if (nr_windows == 0) qApp->quit(); if (nr_windows == 0) qApp->quit();
time_t delay = delayed_commands.lapse - texmacs_time(); time_t delay = delayed_commands.lapse - texmacs_time();
if (needing_update) delay = 0; if (needing_update) delay = 0;
else delay = max (0, min (std_delay, delay)); else delay = max (0, min (std_delay, delay));
updatetimer->start (delay); updatetimer->start (delay);
skipping to change at line 907 skipping to change at line 935
bool bool
qt_gui_rep::put_graphics_on_clipboard (url file) { qt_gui_rep::put_graphics_on_clipboard (url file) {
string extension = suffix (file) ; string extension = suffix (file) ;
// for bitmaps this works : // for bitmaps this works :
if ((extension == "bmp") || (extension == "png") || if ((extension == "bmp") || (extension == "png") ||
(extension == "jpg") || (extension == "jpeg")) { (extension == "jpg") || (extension == "jpeg")) {
QClipboard *clipboard = QApplication::clipboard(); QClipboard *clipboard = QApplication::clipboard();
c_string tmp (concretize (file)); c_string tmp (concretize (file));
clipboard->setImage (QImage (tmp)); clipboard->setImage (QImage (QString (tmp)));
} }
else { else {
// vector formats // vector formats
// Are there applications receiving eps, pdf,... through the clipboard? // Are there applications receiving eps, pdf,... through the clipboard?
// I have not experimented with EMF/WMF (windows) or SVM (Ooo) // I have not experimented with EMF/WMF (windows) or SVM (Ooo)
QString mime ="image/*"; // generic image format; QString mime ="image/*"; // generic image format;
if (extension == "eps") mime = "application/postscript"; if (extension == "eps") mime = "application/postscript";
if (extension == "pdf") mime = "application/pdf"; if (extension == "pdf") mime = "application/pdf";
if (extension == "svg") mime = "image/svg+xml"; //this works with Inskcape v ersion >= 0.47 if (extension == "svg") mime = "image/svg+xml"; //this works with Inskcape v ersion >= 0.47
skipping to change at line 990 skipping to change at line 1018
command_queue::command_queue() : lapse (0), wait (true) { } command_queue::command_queue() : lapse (0), wait (true) { }
command_queue::~command_queue() { clear_pending(); /* implicit */ } command_queue::~command_queue() { clear_pending(); /* implicit */ }
void void
command_queue::exec (object cmd) { command_queue::exec (object cmd) {
q << cmd; q << cmd;
start_times << (((time_t) texmacs_time ()) - 1000000000); start_times << (((time_t) texmacs_time ()) - 1000000000);
lapse = texmacs_time(); lapse = texmacs_time();
the_gui->need_update(); the_gui->need_update();
wait= true;
} }
void void
command_queue::exec_pause (object cmd) { command_queue::exec_pause (object cmd) {
q << cmd; q << cmd;
start_times << ((time_t) texmacs_time ()); start_times << ((time_t) texmacs_time ());
lapse = texmacs_time(); lapse = texmacs_time();
the_gui->need_update(); the_gui->need_update();
wait= true;
} }
void void
command_queue::exec_pending () { command_queue::exec_pending () {
array<object> a = q; array<object> a = q;
array<time_t> b = start_times; array<time_t> b = start_times;
q = array<object> (0); q = array<object> (0);
start_times = array<time_t> (0); start_times = array<time_t> (0);
int i, n = N(a); int i, n = N(a);
for (i = 0; i<n; i++) { for (i = 0; i<n; i++) {
 End of changes. 10 change blocks. 
11 lines changed or deleted 41 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS