void AP_UnixDialog_FormatFrame::runModeless(XAP_Frame * pFrame) { // Build the window's widgets and arrange them m_windowMain = _constructWindow(); UT_return_if_fail(m_windowMain); // Populate the window's data items _populateWindowData(); _connectSignals(); abiSetupModelessDialog(GTK_DIALOG(m_windowMain), pFrame, this, BUTTON_CLOSE); // *** this is how we add the gc for Column Preview *** // attach a new graphics context to the drawing area UT_return_if_fail(m_wPreviewArea && m_wPreviewArea->window); // make a new Unix GC DELETEP (m_pPreviewWidget); GR_UnixCairoAllocInfo ai(m_wPreviewArea); m_pPreviewWidget = (GR_UnixCairoGraphics*) XAP_App::getApp()->newGraphics(ai); // Todo: we need a good widget to query with a probable // Todo: non-white (i.e. gray, or a similar bgcolor as our parent widget) // Todo: background. This should be fine m_pPreviewWidget->init3dColors(m_wPreviewArea->style); // let the widget materialize _createPreviewFromGC(m_pPreviewWidget, static_cast<UT_uint32>(m_wPreviewArea->allocation.width), static_cast<UT_uint32>(m_wPreviewArea->allocation.height)); m_pFormatFramePreview->draw(); startUpdater(); }
void AP_UnixDialog_Lists::runModal( XAP_Frame * pFrame) { FL_ListType savedListType; setModal(); GtkWidget * mainWindow = _constructWindow(); UT_return_if_fail(mainWindow); clearDirty(); // Populate the dialog m_bDontUpdate = false; loadXPDataIntoLocal(); // Need this to stop this being stomped during the contruction of preview widget savedListType = getNewListType(); // *** this is how we add the gc for Lists Preview *** // attach a new graphics context to the drawing area XAP_UnixApp * unixapp = static_cast<XAP_UnixApp *> (m_pApp); UT_ASSERT(unixapp); // Now Display the dialog, so m_wPreviewArea->window exists gtk_widget_show(m_wMainWindow); UT_ASSERT(m_wPreviewArea && m_wPreviewArea->window); // make a new Unix GC GR_UnixCairoAllocInfo ai(m_wPreviewArea); m_pPreviewWidget = (GR_CairoGraphics*) XAP_App::getApp()->newGraphics(ai); // let the widget materialize _createPreviewFromGC(m_pPreviewWidget, static_cast<UT_uint32>(m_wPreviewArea->allocation.width), static_cast<UT_uint32>(m_wPreviewArea->allocation.height)); // Restore our value setNewListType(savedListType); gint response; do { response = abiRunModalDialog (GTK_DIALOG(mainWindow), pFrame, this, BUTTON_CANCEL, false); } while (response == BUTTON_RESET); AP_Dialog_Lists::tAnswer res = getAnswer(); m_glFonts.clear(); abiDestroyWidget ( mainWindow ) ; setAnswer(res); DELETEP (m_pPreviewWidget); }
void AP_UnixDialog_Lists::runModeless (XAP_Frame * pFrame) { static std::pointer_to_unary_function<int, gboolean> s_update_fun = std::ptr_fun(s_update); _constructWindow (); UT_ASSERT (m_wMainWindow); clearDirty(); abiSetupModelessDialog(GTK_DIALOG(m_wMainWindow), pFrame, this, BUTTON_APPLY); connectFocusModelessOther (GTK_WIDGET (m_wMainWindow), m_pApp, &s_update_fun); // Populate the dialog updateDialog(); m_bDontUpdate = false; // Now Display the dialog gtk_widget_show(m_wMainWindow); // *** this is how we add the gc for Lists Preview *** // attach a new graphics context to the drawing area XAP_UnixApp * unixapp = static_cast<XAP_UnixApp *> (m_pApp); UT_ASSERT(unixapp); UT_ASSERT(m_wPreviewArea && m_wPreviewArea->window); // make a new Unix GC GR_UnixCairoAllocInfo ai(m_wPreviewArea->window); m_pPreviewWidget = (GR_CairoGraphics*) XAP_App::getApp()->newGraphics(ai); // let the widget materialize _createPreviewFromGC(m_pPreviewWidget, static_cast<UT_uint32>(m_wPreviewArea->allocation.width), static_cast<UT_uint32>(m_wPreviewArea->allocation.height)); // Next construct a timer for auto-updating the dialog m_pAutoUpdateLists = UT_Timer::static_constructor(autoupdateLists,this); m_bDestroy_says_stopupdating = false; // OK fire up the auto-updater for 0.5 secs m_pAutoUpdateLists->set(500); }
void AP_UnixDialog_Paragraph::runModal(XAP_Frame * pFrame) { m_pFrame = pFrame; // Build the window's widgets and arrange them GtkWidget * mainWindow = _constructWindow(); UT_ASSERT(mainWindow); // Populate the window's data items _populateWindowData(); // Attach signals (after data settings, so we don't trigger // updates yet) _connectCallbackSignals(); // Show the top level dialog, gtk_widget_show(mainWindow); #if defined(EMBEDDED_TARGET) && EMBEDDED_TARGET == EMBEDDED_TARGET_HILDON #else // *** this is how we add the gc *** { // attach a new graphics context to the drawing area UT_ASSERT(m_drawingareaPreview && gtk_widget_get_window(m_drawingareaPreview)); // make a new Unix GC GR_UnixCairoAllocInfo ai(m_drawingareaPreview); m_unixGraphics = (GR_CairoGraphics*) XAP_App::getApp()->newGraphics(ai); // let the widget materialize GtkAllocation allocation; gtk_widget_get_allocation(m_drawingareaPreview, &allocation); _createPreviewFromGC(m_unixGraphics, (UT_uint32) allocation.width, (UT_uint32) allocation.height); } // sync all controls once to get started // HACK: the first arg gets ignored _syncControls(id_MENU_ALIGNMENT, true); #endif bool tabs; do { switch(abiRunModalDialog(GTK_DIALOG(mainWindow), pFrame, this, BUTTON_CANCEL, false)) { case BUTTON_OK: event_OK(); tabs = false; break; case BUTTON_TABS: event_Tabs (); tabs = true; break; default: event_Cancel(); tabs = false; break; } } while (tabs); abiDestroyWidget(mainWindow); }
// This handles the WM_INITDIALOG message for the top-level dialog. BOOL AP_Win32Dialog_FormatTable::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam) { UT_uint32 w,h, i; RECT rect; int nItem; const XAP_StringSet * pSS = m_pApp->getStringSet(); DWORD dwColor = GetSysColor(COLOR_BTNFACE); UT_RGBColor Color(GetRValue(dwColor),GetGValue(dwColor),GetBValue(dwColor)); /* Localise controls*/ _DSX(FORMATTABLE_BTN_CANCEL, DLG_Close); _DSX(FORMATTABLE_BTN_APPLY, DLG_Apply); _DS(FORMATTABLE_TEXT_BACKGROUND, DLG_FormatTable_Color); _DS(FORMATTABLE_TEXT_PREVIEW, DLG_FormatTable_Preview); _DS(FORMATTABLE_TEXT_BORDERS, DLG_FormatTable_Borders); _DS(FORMATTABLE_TEXT_BORDER, DLG_FormatTable_Color); _DS(FORMATTABLE_TEXT_BACKGROUNDS, DLG_FormatTable_Background); _DS(FORMATTABLE_TEXT_APPLYTO, DLG_FormatTable_Apply_To); _DS(FORMATTABLE_BUTTON_SELIMAGE, DLG_FormatTable_SelectImage); _DS(FORMATTABLE_BUTTON_NOIMAGE, DLG_FormatTable_NoImageBackground); _DS(FORMATTABLE_TEXT_THICKNESS, DLG_FormatTable_Thickness); _DS(FORMATTABLE_TEXT_IMGBACK, DLG_FormatTable_SetImageBackground); SetWindowText(hWnd, pSS->getValue(AP_STRING_ID_DLG_FormatTableTitle)); /* Load the bitmaps into the dialog box */ m_hBitmapBottom = _loadBitmap(hWnd,AP_RID_DIALOG_FORMATTABLE_BMP_BOTTOM, "FT_LINEBOTTOM", BITMAP_WITDH, BITMAP_HEIGHT, Color); m_hBitmapTop = _loadBitmap(hWnd,AP_RID_DIALOG_FORMATTABLE_BMP_TOP, "FT_LINETOP", BITMAP_WITDH, BITMAP_HEIGHT, Color); m_hBitmapRight = _loadBitmap(hWnd,AP_RID_DIALOG_FORMATTABLE_BMP_RIGHT, "FT_LINERIGHT", BITMAP_WITDH, BITMAP_HEIGHT, Color); m_hBitmapLeft = _loadBitmap(hWnd,AP_RID_DIALOG_FORMATTABLE_BMP_LEFT, "FT_LINELEFT", BITMAP_WITDH, BITMAP_HEIGHT, Color); /* Preview*/ HWND hwndChild = GetDlgItem(hWnd, AP_RID_DIALOG_FORMATTABLE_STATIC_PREVIEW); UT_return_val_if_fail (hwndChild,0); delete m_pPreviewWidget; m_pPreviewWidget = new XAP_Win32PreviewWidget(static_cast<XAP_Win32App *>(m_pApp), hwndChild, 0); m_pPreviewWidget->getGraphics()->init3dColors(); m_pPreviewWidget->getWindowSize(&w,&h); _createPreviewFromGC(m_pPreviewWidget->getGraphics(), w, h); m_pPreviewWidget->setPreview(m_pFormatTablePreview); startUpdater(); setAllSensitivities(); /* Default status for the push bottons*/ CheckDlgButton(m_hwndDlg, AP_RID_DIALOG_FORMATTABLE_BMP_TOP, getTopToggled() ? BST_CHECKED: BST_UNCHECKED); CheckDlgButton(m_hwndDlg, AP_RID_DIALOG_FORMATTABLE_BMP_BOTTOM, getBottomToggled() ? BST_CHECKED: BST_UNCHECKED); CheckDlgButton(m_hwndDlg, AP_RID_DIALOG_FORMATTABLE_BMP_RIGHT, getRightToggled() ? BST_CHECKED: BST_UNCHECKED); CheckDlgButton(m_hwndDlg, AP_RID_DIALOG_FORMATTABLE_BMP_LEFT, getLeftToggled() ? BST_CHECKED: BST_UNCHECKED); /* Combo Values for Applyto*/ HWND hCombo = GetDlgItem(hWnd, AP_RID_DIALOG_FORMATTABLE_COMBO_APPLYTO); nItem = SendMessage(hCombo, CB_ADDSTRING, 0, (WPARAM) pSS->getValue(AP_STRING_ID_DLG_FormatTable_Apply_To_Selection)); SendMessage(hCombo, CB_SETITEMDATA, nItem, FORMAT_TABLE_SELECTION); nItem = SendMessage(hCombo, CB_ADDSTRING, 0, (WPARAM) pSS->getValue(AP_STRING_ID_DLG_FormatTable_Apply_To_Row)); SendMessage(hCombo, CB_SETITEMDATA, nItem, FORMAT_TABLE_ROW); nItem = SendMessage(hCombo, CB_ADDSTRING, 0, (WPARAM) pSS->getValue(AP_STRING_ID_DLG_FormatTable_Apply_To_Column)); SendMessage(hCombo, CB_SETITEMDATA, nItem, FORMAT_TABLE_COLUMN); nItem = SendMessage(hCombo, CB_ADDSTRING, 0, (WPARAM) pSS->getValue(AP_STRING_ID_DLG_FormatTable_Apply_To_Table)); SendMessage(hCombo, CB_SETITEMDATA, nItem, FORMAT_TABLE_TABLE); SendMessage(hCombo, CB_SETCURSEL, 0, 0); /* Combo Values for Thickness */ hCombo = GetDlgItem(hWnd, AP_RID_DIALOG_FORMATTABLE_COMBO_THICKNESS); for(i=0; i < FORMAT_TABLE_NUMTHICKNESS ; i++) SendMessage(hCombo, CB_ADDSTRING, 0, (WPARAM) sThicknessTable[i]); SendMessage(hCombo, CB_SETCURSEL, 0, 0); XAP_Win32DialogHelper::s_centerDialog(hWnd); return 1; }
// This handles the WM_INITDIALOG message for the top-level dialog. BOOL AP_Win32Dialog_FormatFrame::_onInitDialog(HWND hWnd, WPARAM /*wParam*/, LPARAM /*lParam*/) { HDC hdc; int x, y; UT_uint32 w,h; UT_sint32 i = 0; RECT rect; const XAP_StringSet * pSS = m_pApp->getStringSet(); DWORD dwColor = GetSysColor(COLOR_BTNFACE); UT_RGBColor Color(GetRValue(dwColor),GetGValue(dwColor),GetBValue(dwColor)); /* The four items are the same size */ GetClientRect(GetDlgItem(hWnd, AP_RID_DIALOG_FORMATFRAME_BMP_BOTTOM), &rect); hdc = GetDC(hWnd); x = rect.right - rect.left; y = rect.bottom - rect.top; /* Localise controls*/ _DSX(FORMATFRAME_BTN_CANCEL, DLG_Close); _DSX(FORMATFRAME_BTN_APPLY, DLG_Apply); _DS(FORMATFRAME_TEXT_BACKGROUND, DLG_FormatFrame_Color); _DS(FORMATFRAME_TEXT_PREVIEW, DLG_FormatFrame_Preview); _DS(FORMATFRAME_TEXT_BORDERS, DLG_FormatFrame_Border_Color); _DS(FORMATFRAME_TEXT_BORDER, DLG_FormatFrame_Color); _DS(FORMATFRAME_TEXT_BACKGROUNDS, DLG_FormatFrame_Background); _DS(FORMATFRAME_TEXT_TEXTWRAPS, DLG_FormatFrame_TextWrapping); _DS(FORMATFRAME_CHK_TEXTWRAP, DLG_FormatFrame_SetTextWrapping); _DS(FORMATFRAME_TEXT_POSTEXTPOS, DLG_FormatFrame_PositionTo); _DS(FORMATFRAME_RADIO_PARA, DLG_FormatFrame_SetToParagraph); _DS(FORMATFRAME_RADIO_COLUMN, DLG_FormatFrame_SetToColumn); _DS(FORMATFRAME_RADIO_PAGE, DLG_FormatFrame_SetToPage); _DS(FORMATFRAME_BUTTON_SELIMAGE, DLG_FormatFrame_SelectImage); _DS(FORMATFRAME_BUTTON_NOIMAGE, DLG_FormatFrame_NoImageBackground); _DS(FORMATFRAME_TEXT_THICKNESS, DLG_FormatTable_Thickness); _DS(FORMATFRAME_TEXT_IMGBACK, DLG_FormatFrame_SetImageBackground); setDialogTitle (pSS->getValue(AP_STRING_ID_DLG_FormatFrameTitle)); /* Load the bitmaps into the dialog box */ m_hBitmapBottom = _loadBitmap(hWnd,AP_RID_DIALOG_FORMATFRAME_BMP_BOTTOM, "FT_LINEBOTTOM", BITMAP_WITDH, BITMAP_HEIGHT, Color); m_hBitmapTop = _loadBitmap(hWnd,AP_RID_DIALOG_FORMATFRAME_BMP_TOP, "FT_LINETOP", BITMAP_WITDH, BITMAP_HEIGHT, Color); m_hBitmapRight = _loadBitmap(hWnd,AP_RID_DIALOG_FORMATFRAME_BMP_RIGHT, "FT_LINERIGHT", BITMAP_WITDH, BITMAP_HEIGHT, Color); m_hBitmapLeft = _loadBitmap(hWnd,AP_RID_DIALOG_FORMATFRAME_BMP_LEFT, "FT_LINELEFT", BITMAP_WITDH, BITMAP_HEIGHT, Color); /* Preview*/ HWND hwndChild = GetDlgItem(hWnd, AP_RID_DIALOG_FORMATFRAME_STATIC_PREVIEW); UT_return_val_if_fail (hwndChild,1); m_pPreviewWidget = new XAP_Win32PreviewWidget(static_cast<XAP_Win32App *>(m_pApp), hwndChild, 0); m_pPreviewWidget->getGraphics()->init3dColors(); m_pPreviewWidget->getWindowSize(&w,&h); _createPreviewFromGC(m_pPreviewWidget->getGraphics(), w, h); m_pPreviewWidget->setPreview(m_pFormatFramePreview); startUpdater(); setAllSensitivities(); /* Default status for the dialog controls */ CheckDlgButton(hWnd, AP_RID_DIALOG_FORMATFRAME_BMP_TOP, getTopToggled() ? BST_CHECKED: BST_UNCHECKED); CheckDlgButton(hWnd, AP_RID_DIALOG_FORMATFRAME_BMP_BOTTOM, getBottomToggled() ? BST_CHECKED: BST_UNCHECKED); CheckDlgButton(hWnd, AP_RID_DIALOG_FORMATFRAME_BMP_RIGHT, getRightToggled() ? BST_CHECKED: BST_UNCHECKED); CheckDlgButton(hWnd, AP_RID_DIALOG_FORMATFRAME_BMP_LEFT, getLeftToggled() ? BST_CHECKED: BST_UNCHECKED); /* Position to radio buttons */ if(positionMode() == FL_FRAME_POSITIONED_TO_BLOCK) { CheckRadioButton(hWnd, AP_RID_DIALOG_FORMATFRAME_RADIO_PARA, AP_RID_DIALOG_FORMATFRAME_RADIO_PAGE, AP_RID_DIALOG_FORMATFRAME_RADIO_PARA); } else if(positionMode() == FL_FRAME_POSITIONED_TO_COLUMN) { CheckRadioButton(hWnd, AP_RID_DIALOG_FORMATFRAME_RADIO_PARA, AP_RID_DIALOG_FORMATFRAME_RADIO_PAGE, AP_RID_DIALOG_FORMATFRAME_RADIO_COLUMN); } else if(positionMode() == FL_FRAME_POSITIONED_TO_PAGE) { CheckRadioButton(hWnd, AP_RID_DIALOG_FORMATFRAME_RADIO_PARA, AP_RID_DIALOG_FORMATFRAME_RADIO_PAGE, AP_RID_DIALOG_FORMATFRAME_RADIO_PAGE); } /* Wrapping checkbox */ CheckDlgButton(hWnd, AP_RID_DIALOG_FORMATFRAME_CHK_TEXTWRAP, getWrapping() ? BST_CHECKED: BST_UNCHECKED); /* Combo Values for Thickness */ for(i=0; i < FORMAT_FRAME_NUMTHICKNESS ;i++) addItemToCombo (AP_RID_DIALOG_FORMATFRAME_COMBO_THICKNESS, sThickness[i]); selectComboItem (AP_RID_DIALOG_FORMATFRAME_COMBO_THICKNESS, 0); centerDialog(); return 1; }
BOOL AP_Win32Dialog_Columns::_onInitDialog(HWND hWnd, WPARAM /*wParam*/, LPARAM /*lParam*/) { const XAP_StringSet* pSS = m_pApp->getStringSet(); // Update the caption setDialogTitle(pSS->getValue(AP_STRING_ID_DLG_Column_ColumnTitle)); /* Localise controls*/ _DSX(COLUMN_BTN_OK, DLG_OK); _DSX(COLUMN_BTN_CANCEL, DLG_Cancel); _DS(COLUMN_GROUP1, DLG_Column_Number); _DS(COLUMN_GROUP2, DLG_Column_Preview); _DS(COLUMN_TEXT_ONE, DLG_Column_One); _DS(COLUMN_TEXT_TWO, DLG_Column_Two); _DS(COLUMN_TEXT_THREE, DLG_Column_Three); _DS(COLUMN_CHECK_LINE_BETWEEN, DLG_Column_Line_Between); _DS(COLUMN_TEXT_NUMCOLUMNS, DLG_Column_Number_Cols); _DS(COLUMN_TEXT_SPACEAFTER, DLG_Column_Space_After); _DS(COLUMN_TEXT_MAXSIZE, DLG_Column_Size); _DS(COLUMN_CHECK_RTL_ORDER, DLG_Column_RtlOrder); // Do Bitmaps RECT rect; GetClientRect(GetDlgItem(hWnd, AP_RID_DIALOG_COLUMN_RADIO_ONE), &rect); int iWidth = rect.right - rect.left; int iHeight = rect.bottom - rect.top; HBITMAP hBitmap; AP_Win32Toolbar_Icons Icons; COLORREF ColorRef = GetSysColor(COLOR_BTNFACE); UT_RGBColor Color(GetRValue(ColorRef), GetGValue(ColorRef), GetBValue(ColorRef)); bool bFoundIcon = Icons.getBitmapForIcon(hWnd, iWidth, iHeight, &Color, "1COLUMN", &hBitmap); UT_return_val_if_fail (bFoundIcon, false); SendDlgItemMessageW(hWnd, AP_RID_DIALOG_COLUMN_RADIO_ONE, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap); bFoundIcon = Icons.getBitmapForIcon(hWnd, iWidth, iHeight, &Color, "2COLUMN", &hBitmap); UT_return_val_if_fail (bFoundIcon, false); SendDlgItemMessageW(hWnd, AP_RID_DIALOG_COLUMN_RADIO_TWO, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap); bFoundIcon = Icons.getBitmapForIcon(hWnd, iWidth, iHeight, &Color, "3COLUMN", &hBitmap); UT_return_val_if_fail (bFoundIcon, false); SendDlgItemMessageW(hWnd, AP_RID_DIALOG_COLUMN_RADIO_THREE, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap); // set initial state wchar_t buf[BUFSIZE]; checkButton(AP_RID_DIALOG_COLUMN_RADIO_ONE + getColumns() - 1, true); enableLineBetweenControl(getColumns() != 1); checkButton(AP_RID_DIALOG_COLUMN_CHECK_LINE_BETWEEN, getLineBetween()); SetDlgItemTextW(m_hDlg, AP_RID_DIALOG_COLUMN_EDIT_NUMCOLUMNS, _itow( getColumns(),buf,10) ); setControlText(AP_RID_DIALOG_COLUMN_EDIT_SPACEAFTER, getSpaceAfterString()); setControlText(AP_RID_DIALOG_COLUMN_EDIT_MAXSIZE, getHeightString()); showControl( AP_RID_DIALOG_COLUMN_CHECK_RTL_ORDER, SW_NORMAL ); checkButton(AP_RID_DIALOG_COLUMN_CHECK_RTL_ORDER, getColumnOrder()!=false); // Create a preview window. HWND hwndChild = GetDlgItem(hWnd, AP_RID_DIALOG_COLUMN_PREVIEW); m_pPreviewWidget = new XAP_Win32PreviewWidget(static_cast<XAP_Win32App *>(m_pApp), hwndChild, 0); UT_uint32 w,h; m_pPreviewWidget->getWindowSize(&w,&h); //m_pPreviewWidget->init3dColors(m_wpreviewArea->style); m_pPreviewWidget->getGraphics()->init3dColors(); _createPreviewFromGC(m_pPreviewWidget->getGraphics(), w, h); m_pPreviewWidget->setPreview(m_pColumnsPreview); centerDialog(); return 1; // 1 == we did not call SetFocus() }
BOOL AP_Win32Dialog_Paragraph::_onInitTab(HWND hWnd, WPARAM wParam, LPARAM lParam) { const XAP_StringSet * pSS = m_pApp->getStringSet(); UT_Win32LocaleString str; // position ourselves w.r.t. containing tab RECT r; GetClientRect(m_hwndTab, &r); TabCtrl_AdjustRect(m_hwndTab, FALSE, &r); SetWindowPos(hWnd, HWND_TOP, r.left, r.top, 0, 0, SWP_NOSIZE); // remember which window is which tab TabParam * pTP = (TabParam *) lParam; switch (pTP->which) { case AP_RID_DIALOG_PARA_TAB1: // first tab { m_hwndSpacing = hWnd; // Hide Bidi Check Box unless required { HWND hwndBidi = GetDlgItem(hWnd, AP_RID_DIALOG_PARA_CHECK_BIDI); ShowWindow(hwndBidi,SW_HIDE); ShowWindow(hwndBidi,SW_SHOW); } // localize controls _DS(PARA_TEXT_ALIGN, DLG_Para_LabelAlignment); _DS(PARA_TEXT_INDENT, DLG_Para_LabelIndentation); _DS(PARA_TEXT_LEFT, DLG_Para_LabelLeft); _DS(PARA_TEXT_RIGHT, DLG_Para_LabelRight); _DS(PARA_TEXT_HANG, DLG_Para_LabelSpecial); _DS(PARA_TEXT_BY, DLG_Para_LabelBy); _DS(PARA_TEXT_SPACING, DLG_Para_LabelSpacing); _DS(PARA_TEXT_BEFORE, DLG_Para_LabelBefore); _DS(PARA_TEXT_AFTER, DLG_Para_LabelAfter); _DS(PARA_TEXT_LEAD, DLG_Para_LabelLineSpacing); _DS(PARA_TEXT_AT, DLG_Para_LabelAt); _DS(PARA_CHECK_BIDI, DLG_Para_DomDirection); // populate fixed choices { HWND hwndAlign = GetDlgItem(hWnd, AP_RID_DIALOG_PARA_COMBO_ALIGN); // insert the empty value (for multi-para selections with different state) SendMessageW(hwndAlign, CB_ADDSTRING, 0, (LPARAM) L""); _CAS(hwndAlign, DLG_Para_AlignLeft); _CAS(hwndAlign, DLG_Para_AlignCentered); _CAS(hwndAlign, DLG_Para_AlignRight); _CAS(hwndAlign, DLG_Para_AlignJustified); SendMessageW(hwndAlign, CB_SETCURSEL, (WPARAM) _getMenuItemValue(id_MENU_ALIGNMENT), 0); HWND hwndHang = GetDlgItem(hWnd, AP_RID_DIALOG_PARA_COMBO_HANG); SendMessageW(hwndHang, CB_ADDSTRING, 0, (LPARAM) L""); _CAS(hwndHang, DLG_Para_SpecialNone); _CAS(hwndHang, DLG_Para_SpecialFirstLine); _CAS(hwndHang, DLG_Para_SpecialHanging); SendMessageW(hwndHang, CB_SETCURSEL, (WPARAM) _getMenuItemValue(id_MENU_SPECIAL_INDENT), 0); HWND hwndLead = GetDlgItem(hWnd, AP_RID_DIALOG_PARA_COMBO_LEAD); SendMessageW(hwndLead, CB_ADDSTRING, 0, (LPARAM) L""); _CAS(hwndLead, DLG_Para_SpacingSingle); _CAS(hwndLead, DLG_Para_SpacingHalf); _CAS(hwndLead, DLG_Para_SpacingDouble); _CAS(hwndLead, DLG_Para_SpacingAtLeast); _CAS(hwndLead, DLG_Para_SpacingExactly); _CAS(hwndLead, DLG_Para_SpacingMultiple); SendMessageW(hwndLead, CB_SETCURSEL, (WPARAM) _getMenuItemValue(id_MENU_SPECIAL_SPACING), 0); } // set initial state _SST(PARA_EDIT_LEFT, id_SPIN_LEFT_INDENT); _SST(PARA_EDIT_RIGHT, id_SPIN_RIGHT_INDENT); _SST(PARA_EDIT_BY, id_SPIN_SPECIAL_INDENT); _SST(PARA_EDIT_BEFORE, id_SPIN_BEFORE_SPACING); _SST(PARA_EDIT_AFTER, id_SPIN_AFTER_SPACING); _SST(PARA_EDIT_AT, id_SPIN_SPECIAL_SPACING); _CDB(PARA_CHECK_BIDI, id_CHECK_DOMDIRECTION); } break; case AP_RID_DIALOG_PARA_TAB2: // second tab { m_hwndBreaks = hWnd; // localize controls _DS(PARA_TEXT_PAGE, DLG_Para_LabelPagination); _DS(PARA_CHECK_WIDOW, DLG_Para_PushWidowOrphanControl); _DS(PARA_CHECK_NEXT, DLG_Para_PushKeepWithNext); _DS(PARA_CHECK_TOGETHER, DLG_Para_PushKeepLinesTogether); _DS(PARA_CHECK_BREAK, DLG_Para_PushPageBreakBefore); _DS(PARA_CHECK_SUPPRESS, DLG_Para_PushSuppressLineNumbers); _DS(PARA_CHECK_NOHYPHEN, DLG_Para_PushNoHyphenate); // set initial state _CDB(PARA_CHECK_WIDOW, id_CHECK_WIDOW_ORPHAN); _CDB(PARA_CHECK_NEXT, id_CHECK_KEEP_NEXT); _CDB(PARA_CHECK_TOGETHER, id_CHECK_KEEP_LINES); _CDB(PARA_CHECK_BREAK, id_CHECK_PAGE_BREAK); _CDB(PARA_CHECK_SUPPRESS, id_CHECK_SUPPRESS); _CDB(PARA_CHECK_NOHYPHEN, id_CHECK_NO_HYPHENATE); } break; default: UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN); break; } // the following are common to each tab _DS(PARA_TEXT_PREVIEW, DLG_Para_LabelPreview); if (!m_pPreviewWidget) { // for XP purposes, life is simplest if we only have one preview // widget which "floats" above both tabs. to get the window // parentage right, we use the dimensions and location of the // owner-draw control on the tab to position *another* dummy // window which is parented by the main dialog instead. HWND hwndChild = GetDlgItem(hWnd, AP_RID_DIALOG_PARA_PREVIEW); HWND hwndFloater = GetDlgItem(m_hwndDlg, AP_RID_DIALOG_PARA_PREVIEW); RECT r2; GetWindowRect(hwndChild, &r2); POINT pt; pt.x = r2.left; pt.y = r2.top; ScreenToClient(m_hwndDlg, &pt); SetWindowPos(hwndFloater, HWND_TOP, pt.x, pt.y, r2.right - r2.left, r2.bottom - r2.top, SWP_NOREDRAW); // use this floater window as a parent to the widget that we create // here and thus have complete control of. m_pPreviewWidget = new XAP_Win32PreviewWidget(static_cast<XAP_Win32App *>(m_pApp), hwndFloater, 0); // instantiate the XP preview object using the win32 preview widget (window) // we just created. we seem to have a mish-mash of terms here, sorry. UT_uint32 w,h; m_pPreviewWidget->getWindowSize(&w,&h); _createPreviewFromGC(m_pPreviewWidget->getGraphics(),w,h); m_pPreviewWidget->setPreview(m_paragraphPreview); // we need this to call draw() on WM_PAINTs // _updatePreview(); } return 1; // 1 == we did not call SetFocus() }