double qt_pointSize(double pixelSize, QPaintDevice *paintdevice, int scr) { if (pixelSize < 0) return -1.; double result = pixelSize; if ( paintdevice && QPaintDeviceMetrics( paintdevice ).logicalDpiY() != 75) result *= 72. / QPaintDeviceMetrics( paintdevice ).logicalDpiY(); else if (QPaintDevice::x11AppDpiY(scr) != 75) result *= 72. / QPaintDevice::x11AppDpiY( scr ); return result; }
QSize Board::sizeHint() const { int dpi = QPaintDeviceMetrics(this).logicalDpiX(); if (dpi < 75) dpi = 75; return QSize(9*dpi,7*dpi); }
double FLFontSize::pointSize( const QFontDef &fd, QPaintDevice *paintdevice ) { int dpi = GetDeviceCaps( qt_display_dc(), LOGPIXELSY ); double pSize; if ( paintdevice ) { dpi = QPaintDeviceMetrics( paintdevice ).logicalDpiY(); } if ( fd.pointSize < 0 ) { if ( paintdevice ) { pSize = fd.pixelSize * 72. / ( ( float ) dpi ); dpi = QPaintDeviceMetrics( paintdevice ).logicalDpiY(); pSize = pSize * 72. / ( ( float ) dpi ); } else pSize = fd.pixelSize * 72. / ( ( float ) dpi ); } else pSize = fd.pointSize; return pSize / 10; }
double FLFontSize::pixelSize( const QFontDef &request, QPaintDevice *paintdevice ) { int dpi = GetDeviceCaps( qt_display_dc(), LOGPIXELSY ); double pSize; if ( request.pointSize != -1 ) { if ( paintdevice ) { pSize = request.pointSize * dpi / 72.; dpi = QPaintDeviceMetrics( paintdevice ).logicalDpiY(); pSize = pSize * dpi / 72.; } else pSize = request.pointSize * dpi / 72.; } else pSize = request.pixelSize; return pSize / 10; }
QDBase::QDBase(QWidget * parent, const char * name) : QWidget(parent, name) { DEBUG_MSG("QDBase::QDBase(): Initializing class...\n"); DEBUG_MAKE_INDENT(3); being_destroyed=false; map_area_tip=0; cur_map_area=0; display_all_hlinks=false; image_size_known=0; toolbar=0; mode_tbar=0; rotate_tbar=0; toolbar_shown=0; toolbar_enabled=0; toolbar_asked=0; showing_toolbar=0; splitter=0; main_widget=0; thumb_widget=0; cmd_mode=cmd_mode_force=cmd_zoom=-1; zoom_src=SRC_DEFAULT; mode_src=SRC_DEFAULT; rotate_src=SRC_DEFAULT; in_hand_scroll=in_paint=in_layout=in_zoom_select=0; lastrect=0; acc_scroll_dh=acc_scroll_dv=0; left_butt_down=0; ignore_ant_mode_zoom=0; for(int i=0;i<MODE_SOURCE_MAX;i++) mode_prio[i]=i; pane_mode=IDC_PANE; djvu_logo_bmp = GBitmap::create(*CINData::get("ppm_djvu_logo")); depth=QPaintDeviceMetrics(this).depth(); new QDTBHider(this); // Get the display resolution QPaintDeviceMetrics m(QApplication::desktop()); displ_dpi=(int) (m.width()*25.4/m.widthMM()); displ_dpi=100; // Override displ_dpi as Leon demands DEBUG_MSG("display dpi=" << displ_dpi << "\n"); // Adjusting margin caches pm_cache.setMaxSize(prefs.mcacheSize*1024*1024); bm_cache.setMaxSize(prefs.mcacheSize*1024*1024); connect(&cache_timer, SIGNAL(timeout(void)), this, SLOT(slotCheckCache(void))); main_widget=new QWidget(this, "main_widget"); main_widget->installEventFilter(this); pane=new QDPane(main_widget, "djvu_pane"); pane->installEventFilter(this); pane->setFocusPolicy(QWidget::StrongFocus); pane->setMouseTracking(TRUE); // Creating main area and scroll bars hscroll=new QScrollBar(QScrollBar::Horizontal, main_widget, "hscroll"); vscroll=new QScrollBar(QScrollBar::Vertical, main_widget, "vscroll"); connect(hscroll, SIGNAL(valueChanged(int)), this, SLOT(slotSliderMoved(int))); connect(vscroll, SIGNAL(valueChanged(int)), this, SLOT(slotSliderMoved(int))); connect(hscroll, SIGNAL(sliderPressed(void)), this, SLOT(slotSliderPressed(void))); connect(vscroll, SIGNAL(sliderPressed(void)), this, SLOT(slotSliderPressed(void))); connect(hscroll, SIGNAL(sliderReleased(void)), this, SLOT(slotSliderReleased(void))); connect(vscroll, SIGNAL(sliderReleased(void)), this, SLOT(slotSliderReleased(void))); hscroll->resize(hscroll->sizeHint()); vscroll->resize(vscroll->sizeHint()); createCursors(); setBackgroundColor(0xffffff, false); // Don't redraw // Setting desired video modes setMode(IDC_DISPLAY_COLOR, 0, SRC_DEFAULT); // Don't redraw setZoom(prefs.nDefaultZoom, 0, SRC_DEFAULT); // Don't relayout setRotate(IDC_ROTATE_0, 0, SRC_DEFAULT); // Don't relayout layout(0); // Disallow redraw }