void ViewerWindow::commandToolBar() { if (m_toolbar.isVisible()) { m_menu.checkedMenuItem(IDS_TB_TOOLBAR, false); m_toolbar.hide(); doSize(); } else { if (!m_isFullScr) { m_menu.checkedMenuItem(IDS_TB_TOOLBAR, true); m_toolbar.show(); doSize(); } } }
SDL_Rect Fontinfo::calcUpdatedArea(float start_x, int start_y, int ratio1, int ratio2) { doSize(); SDL_Rect rect; if (start_y == pos_y) { // if single line, return minimum width rect.x = top_x + (long) floor(start_x); rect.w = (long) ceil(pos_x - start_x); } else { // multi-line: return full width rect.x = top_x; rect.w = area_x; } rect.y = top_y + start_y; rect.h = pos_y - start_y + line_space(); rect.x = rect.x * ratio1 / ratio2; rect.y = rect.y * ratio1 / ratio2; rect.w = rect.w * ratio1 / ratio2; rect.h = rect.h * ratio1 / ratio2; return rect; }
float Fontinfo::StringAdvance(const char* string) { // This relates to display, so we take ligatures into account. doSize(); wchar unicode, next; int cb, nextcb; float orig_x = pos_x; int orig_mod = font_size_mod, orig_style = style, orig_y = pos_y; unicode = file_encoding->DecodeWithLigatures(string, *this, cb); while (*string) { next = file_encoding->DecodeWithLigatures(string + cb, *this, nextcb); if (!processCode(string)) { if (is_bidirect) pos_x -= GlyphAdvance(unicode, next); else pos_x += GlyphAdvance(unicode, next); } string += cb; unicode = next; cb = nextcb; } float rv = pos_x - orig_x; font_size_mod = orig_mod; style = orig_style; pos_x = orig_x; pos_y = orig_y; return rv; }
void ViewerWindow::applySettings() { int scale; if (m_conConf->isFitWindowEnabled()) { scale = -1; } else { int iNum = m_conConf->getScaleNumerator(); int iDenom = m_conConf->getScaleDenominator(); scale = (iNum * 100) / iDenom; } if (scale != m_scale) { m_scale = scale; m_dsktWnd.setScale(m_scale); doSize(); } if (m_isConnected) { if (m_conConf->isFullscreenEnabled()) { doFullScr(); } else { doUnFullScr(); } } changeCursor(m_conConf->getLocalCursorShape()); enableUserElements(); viewerCoreSettings(); }
float Fontinfo::GlyphAdvance(unsigned short unicode, unsigned short next) { if (unicode >= 0x10 && unicode < 0x20) return 0; doSize(); float adv = font()->advance(unicode); #ifdef KERNING if (next) adv += font()->kerning(unicode, next); #endif return adv + float(pitch_x); }
void Fontinfo::setLineArea(int num) { doSize(); if (is_vertical) { area_x = size(); area_y = num; } else { area_x = num; area_y = line_space(); } }
void OptionsCanvas::updateEnabled(void) { RECT rect; GetClientRect(hWindow, &rect); // We're not actually resizing, but since the resize code properly handles // the enable/disable, that's the easiest way to update it. No, it's not // very efficient, but it's not slow enough for the user to notice. doSize(SIZE_RESTORED, rect.right, rect.bottom); // We didn't actually resize, and the resize code doesn't update the child // windows as it goes, so force a redraw (erase background not needed). RedrawWindow(hWindow, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); }
void Fontinfo::newLine() { doSize(); if (is_vertical){ pos_x -= size() + pitch_x; pos_y = indent; } else if (is_bidirect){ pos_x = area_x - indent; pos_y += line_space() + pitch_y; } else{ pos_x = indent; pos_y += line_space() + pitch_y; } //pos_x = indent; //pos_y += line_space() + pitch_y; }
int Fontinfo::line_space() { doSize(); return font()->lineskip(); }
float Fontinfo::em_width() { doSize(); return font()->advance('M'); }
INT_PTR CUIDialog::dialogProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: return (INT_PTR)doInitDialog((HWND)wParam); break; case WM_COMMAND: return (INT_PTR)doPrivateCommand(message, wParam, lParam); case WM_DESTROY: if (doDestroy() == 0) { return (INT_PTR)TRUE; } break; case WM_VSCROLL: if (doVScroll((int)(short)LOWORD(wParam), (int)(short)HIWORD(wParam), (HWND)lParam) == 0) { return (INT_PTR)TRUE; } break; case WM_HSCROLL: if (doHScroll((int)(short)LOWORD(wParam), (int)(short)HIWORD(wParam), (HWND)lParam) == 0) { return (INT_PTR)TRUE; } break; case WM_NOTIFY: return (INT_PTR)doPrivateNotify(message, wParam, lParam); case WM_MOVE: if (doMove((int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)) == 0) { return (INT_PTR)TRUE; } break; case WM_SIZE: if (doSize(wParam, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)) == 0) { return (INT_PTR)TRUE; } break; case WM_ENTERMENULOOP: if (doEnterMenuLoop(wParam ? true : false) == 0) { return (INT_PTR)TRUE; } break; case WM_EXITMENULOOP: if (doExitMenuLoop(wParam ? true : false) == 0) { return (INT_PTR)TRUE; } break; case WM_INITMENUPOPUP: if (doInitMenuPopup((HMENU)wParam, (UINT)LOWORD(lParam), (BOOL)HIWORD(lParam)) == 0) { return (INT_PTR)TRUE; } break; case WM_KEYDOWN: if (doKeyDown((int)wParam, lParam) == 0) { return (INT_PTR)TRUE; } break; case WM_KEYUP: if (doKeyUp((int)wParam, lParam) == 0) { return (INT_PTR)TRUE; } break; case WM_CLOSE: if (doClose() == 0) { return (INT_PTR)TRUE; } break; case WM_TIMER: if (doTimer(wParam) == 0) { return (INT_PTR)TRUE; } break; case WM_GETMINMAXINFO: if (doGetMinMaxInfo(hDlg, (LPMINMAXINFO)lParam) == 0) { return (INT_PTR)TRUE; } break; case WM_MOUSEWHEEL: if (doMouseWheel(LOWORD(wParam), HIWORD(wParam), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)) == 0) { return (INT_PTR)TRUE; } break; case WM_CONTEXTMENU: if (doContextMenu((HWND)wParam, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)) == 0) { return (INT_PTR)TRUE; } break; case WM_DRAWITEM: return doPrivateDrawItem(message, wParam, lParam); } return (INT_PTR)FALSE; }
void ViewerWindow::applyScreenChanges(bool isFullScreen) { m_isFullScr = isFullScreen; doSize(); redraw(); }