Exemplo n.º 1
0
void XAP_Dialog_FontChooser::setHidden(bool bHidden)
{
	static char none[] = "none";
	static char empty[]  = "";

	if(bHidden)
	{
		addOrReplaceVecProp("display",none);
	}
	else
	{
		addOrReplaceVecProp("display",empty);
	}
	m_bHidden = bHidden;
}
Exemplo n.º 2
0
void XAP_Dialog_FontChooser::setFontDecoration(bool bUnderline, bool bOverline, bool bStrikeOut, bool bTopline, bool bBottomline)
{
	m_bUnderline = bUnderline;
	m_bOverline = bOverline;
	m_bStrikeout = bStrikeOut;
	m_bTopline = bTopline;
	m_bBottomline = bBottomline;

	static gchar s[50];
	UT_String decors;
	decors.clear();
	if(bUnderline)
		decors += "underline ";
	if(bStrikeOut)
		decors += "line-through ";
	if(bOverline)
		decors += "overline ";
	if(bTopline)
		decors += "topline ";
	if(bBottomline)
		decors += "bottomline ";
	if(!bUnderline && !bStrikeOut && !bOverline && !bTopline && !bBottomline)
		decors = "none";
	sprintf(s,"%s",decors.c_str());
	addOrReplaceVecProp("text-decoration",(const gchar *) s);
}
Exemplo n.º 3
0
void XAP_Dialog_FontChooser::setSubScript(bool bSubScript)
{
	static char none[] = "subscript";
	static char empty[]  = "";

	if(bSubScript)
	{
		addOrReplaceVecProp("text-position",none);
	}
	else
	{
		addOrReplaceVecProp("text-position",empty);
	}
	m_bSubScript = bSubScript;
	
}
Exemplo n.º 4
0
void XAP_UnixDialog_FontChooser::transparencyChanged(void)
{
	bool bTrans = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_checkTransparency));
	if(bTrans)
	{
		addOrReplaceVecProp("bgcolor","transparent");
		m_currentBGColorTransparent = true;
	}
	updatePreview();
}
Exemplo n.º 5
0
void XAP_UnixDialog_FontChooser::fgColorChanged(void)
{
	gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER(m_colorSelector),
							   &m_currentFGColor);
	UT_RGBColor * rgbcolor = UT_UnixGdkColorToRGBColor(m_currentFGColor);
	UT_HashColor hash_color;
	const char * c = hash_color.setColor(*rgbcolor);
	addOrReplaceVecProp("color",  c + 1);
	delete rgbcolor;
	updatePreview();
}
Exemplo n.º 6
0
void XAP_UnixDialog_FontChooser::bgColorChanged(void)
{
	gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER(m_bgcolorSelector),
								&m_currentBGColor);
	UT_RGBColor * rgbcolor = UT_UnixGdkColorToRGBColor(m_currentBGColor);
	UT_HashColor hash_color;
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_checkTransparency), FALSE);
	m_currentBGColorTransparent = false;
	// test for funkyColor-has-been-changed-to-sane-color case
	addOrReplaceVecProp("bgcolor", hash_color.setColor(*rgbcolor) + 1);
	delete rgbcolor;
	updatePreview();
}
Exemplo n.º 7
0
void XAP_FontPreview::_createFontPreviewFromGC(GR_Graphics * gc,
											   UT_uint32 width,
											   UT_uint32 height)
{
	UT_ASSERT(gc);
	UT_DEBUGMSG(("SEVIOR!!!!!!!!!!! font priview created!!!!!\n"));
	m_pFontPreview = new XAP_Preview_FontPreview(gc,NULL);
	UT_return_if_fail(m_pFontPreview);
	
	m_pFontPreview->setDrawString(m_drawString);
	m_pFontPreview->setVecProperties(&m_mapProps);
	m_pFontPreview->setWindowSize(width, height);
	m_width = gc->tlu(width);
	m_height = gc->tlu(height);
	addOrReplaceVecProp("font-size","36pt");
}
Exemplo n.º 8
0
void XAP_UnixDialog_FontChooser::styleRowChanged(void)
{
	GtkTreeSelection* selection;
	GtkTreeModel* model;
	GtkTreeIter iter;
	gint rowNumber;
	GtkTreePath* path;

	selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(m_styleList));
	if ( gtk_tree_selection_get_selected (selection, &model, &iter) )
	{
		path = gtk_tree_model_get_path(model, &iter);
		rowNumber = gtk_tree_path_get_indices(path)[0];
		gtk_tree_path_free(path);

		// perhaps these attributes really should be smashed
		// into bitfields.  :)
		if (rowNumber == LIST_STYLE_NORMAL)
		{
			addOrReplaceVecProp("font-style","normal");
			addOrReplaceVecProp("font-weight","normal");
		}
		else if (rowNumber == LIST_STYLE_BOLD)
		{
			addOrReplaceVecProp("font-style","normal");
			addOrReplaceVecProp("font-weight","bold");
		}
		else if (rowNumber == LIST_STYLE_ITALIC)
		{
			addOrReplaceVecProp("font-style","italic");
			addOrReplaceVecProp("font-weight","normal");
		}
		else if (rowNumber == LIST_STYLE_BOLD_ITALIC)
		{
			addOrReplaceVecProp("font-style","italic");
			addOrReplaceVecProp("font-weight","bold");
		}
		else
		{
			UT_ASSERT_HARMLESS(0);
		}
	}
	updatePreview();
}
Exemplo n.º 9
0
void XAP_UnixDialog_FontChooser::fontRowChanged(void)
{
	static char szFontFamily[60];
	GtkTreeSelection *selection;
	GtkTreeModel *model;
	GtkTreeIter iter;
	gchar *text;

	model = gtk_tree_view_get_model(GTK_TREE_VIEW(m_fontList));
	selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(m_fontList));
	if ( gtk_tree_selection_get_selected (selection, &model, &iter) )
	{
		gtk_tree_model_get(model, &iter, TEXT_COLUMN, &text, -1);
		g_snprintf(szFontFamily, 50, "%s",text);
		g_free(text), text = NULL;
		addOrReplaceVecProp("font-family",static_cast<gchar*>(szFontFamily));
	}

	updatePreview();
}
Exemplo n.º 10
0
void XAP_UnixDialog_FontChooser::sizeRowChanged(void)
{
	// used similarly to convert between text and numeric arguments
	static char szFontSize[50];
	GtkTreeSelection* selection;
	GtkTreeModel* model;
	GtkTreeIter iter;
	gchar* text;

	selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(m_sizeList));
	if ( gtk_tree_selection_get_selected (selection, &model, &iter) )
	{
		gtk_tree_model_get(model, &iter, TEXT_COLUMN, &text, -1);
		UT_ASSERT(text);
		g_snprintf(szFontSize, 50, "%spt",
				   static_cast<const gchar *>(XAP_EncodingManager::fontsizes_mapping.lookupByTarget(text)));
		g_free(text), text = NULL;
		addOrReplaceVecProp("font-size",static_cast<gchar *>(szFontSize));
	}
	updatePreview();
}
Exemplo n.º 11
0
void XAP_UnixDialog_FontChooser::textTransformChanged(void)
{
#if 0
	// todo
	static char szTextTransform[60];
	GtkTreeSelection *selection;
	GtkTreeModel *model;
	GtkTreeIter iter;
	gchar *text;

	model = gtk_tree_view_get_model(GTK_TREE_VIEW(m_fontList));
	selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(m_fontList));
	if ( gtk_tree_selection_get_selected (selection, &model, &iter) )
	{
		gtk_tree_model_get(model, &iter, TEXT_COLUMN, &text, -1);
		g_snprintf(szTextTransform, 50, "%s",text);
		g_free(text), text = NULL;
		addOrReplaceVecProp("text-transform",static_cast<gchar*>(szTextTransform));
	}
#endif

	updatePreview();
}
Exemplo n.º 12
0
void XAP_Dialog_FontChooser::setFontFamily(const std::string& sFontFamily)
{
	m_sFontFamily = sFontFamily;
	addOrReplaceVecProp("font-family",sFontFamily);
}
Exemplo n.º 13
0
void XAP_Dialog_FontChooser::setTextTransform(const std::string& sTextTransform)
{
	m_sTextTransform = sTextTransform;
	addOrReplaceVecProp("text-transform",sTextTransform);
}
Exemplo n.º 14
0
void XAP_Dialog_FontChooser::setFontWeight(const std::string& sFontWeight)
{
	m_sFontWeight = sFontWeight;
	addOrReplaceVecProp("font-weight",sFontWeight);
}
Exemplo n.º 15
0
void XAP_FontPreview::setFontFamily(const gchar * pFontFamily)
{
	addOrReplaceVecProp("font-family",pFontFamily);
}
Exemplo n.º 16
0
void XAP_Dialog_FontChooser::setFontStyle(const std::string& sFontStyle)
{
	m_sFontStyle = sFontStyle;
	addOrReplaceVecProp("font-style",sFontStyle);
}
Exemplo n.º 17
0
void XAP_Dialog_FontChooser::setBGColor(const std::string& sBGColor)
{
	m_sBGColor = sBGColor;
	addOrReplaceVecProp("bgcolor",sBGColor);
}
Exemplo n.º 18
0
void XAP_Dialog_FontChooser::setColor(const std::string& sColor)
{
	m_sColor = sColor;
	addOrReplaceVecProp("color",sColor);
}