[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[help-gv] Old i18n patch
From: |
Orion Poplawski |
Subject: |
[help-gv] Old i18n patch |
Date: |
Thu, 15 Dec 2005 15:35:47 -0700 |
User-agent: |
Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929) |
Found the attached i18n patch here:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=71074.
It applies and compiles but I don't know if it makes sense. Could
someone please review?
--
Orion Poplawski
System Administrator 303-415-9701 x222
Colorado Research Associates/NWRA FAX: 303-415-9702
3380 Mitchell Lane, Boulder CO 80301 http://www.co-ra.com
--- gv-3.5.8/src/Vlist.c.orig 1997-06-07 07:00:00.000000000 +0900
+++ gv-3.5.8/src/Vlist.c 2002-08-29 12:36:50.000000000 +0900
@@ -317,12 +317,12 @@
if (s) {
char *nl = strchr(s,'\n');
if (nl) *nl = '\0';
- XDrawString(XtDisplay(w), XtWindow(w), vw->label.normal_GC,
- vw->label.label_x,
- vw->label.label_y+entry*(vw->label.font->max_bounds.ascent +
- vw->label.font->max_bounds.descent) +
- vw->label.font->max_bounds.ascent,
- s, (int)strlen(s));
+ XmbDrawString(XtDisplay(w), XtWindow(w),
+ vw->label.fontset, vw->label.normal_GC,
+ vw->label.label_x,
+
vw->label.label_y+entry*vw->label.label_height/vw->vlist.entries
+ - XExtentsOfFontSet(vw->label.fontset)->max_logical_extent.y
+1,
+ s, (int)strlen(s));
if (nl) *nl = '\n';
}
ENDMESSAGE1(PaintEntryString)
--- gv-3.5.8/src/dialog.c.orig 1997-06-07 07:00:00.000000000 +0900
+++ gv-3.5.8/src/dialog.c 2002-08-29 12:36:50.000000000 +0900
@@ -271,7 +271,8 @@
# define DIALOG_POPUP_TEXT_MIN_WIDTH 100
String os;
Dimension lm,rm,bw,nw;
- XFontStruct *font;
+ XFontStruct *font = NULL;
+ XFontSet fontset;
BEGINMESSAGE(DialogPopupSetText)
if (!s) {INFMESSAGE(no text) ENDMESSAGE(DialogPopupSetText) return;}
@@ -280,6 +281,7 @@
n=0;
XtSetArg(args[n], XtNfont, &font); n++;
+ XtSetArg(args[n], XtNfontSet, &fontset); n++;
XtSetArg(args[n], XtNleftMargin, &lm); n++;
XtSetArg(args[n], XtNrightMargin, &rm); n++;
XtSetArg(args[n], XtNborderWidth, &bw); n++;
@@ -287,8 +289,13 @@
XtSetArg(args[n], XtNwidth, &width); n++;
XtGetValues(response, args, n);
n=0;
- nw=
((font->max_bounds.width+font->min_bounds.width)*((Dimension)strlen(s))+1)/2
+ if( font != NULL ) {
+ nw=
((font->max_bounds.width+font->min_bounds.width)*((Dimension)strlen(s))+1)/2
+lm+rm+DIALOG_POPUP_FREE_SPACE+2*bw;
+ } else {
+ nw= XmbTextEscapement( fontset, s, strlen(s))
+ +lm+rm+DIALOG_POPUP_FREE_SPACE+2*bw;
+ }
if (nw<DIALOG_POPUP_TEXT_MIN_WIDTH) nw=DIALOG_POPUP_TEXT_MIN_WIDTH;
if (nw>width) {
INFIMESSAGE(new width,nw)
--- gv-3.5.8/src/info.c.orig 1997-04-26 07:00:00.000000000 +0900
+++ gv-3.5.8/src/info.c 2002-08-29 12:36:50.000000000 +0900
@@ -64,6 +64,20 @@
static Bool infoPopupVisible = False;
static int info_length;
+static int FontSetWidth( XFontSet fnt ) {
+ XRectangle ink_array_return, logical_array_return;
+ XRectangle overall_ink_return, overall_logical_return;
+ int num_chars_return;
+ XmbTextPerCharExtents( fnt, "A", 1,
+ &ink_array_return,
+ &logical_array_return, 1,
+ &num_chars_return,
+ &overall_ink_return,
+ &overall_logical_return );
+ return( overall_logical_return.width );
+}
+#define FontSetHeight(fnt)
(XExtentsOfFontSet(fnt)->max_logical_extent.height)
+
/*###############################################################################
cb_popupInfoPopup
###############################################################################*/
@@ -139,7 +153,7 @@
/*###############################################################################
cb_resetInfoPopup
-###############################################################################*/
+##############################################################################*/
void cb_resetInfoPopup(w, client_data, call_data)
Widget w;
@@ -178,7 +192,8 @@
Cardinal n;
Dimension bottomMargin, leftMargin, rightMargin, topMargin;
Dimension width, height;
- XFontStruct *font;
+ XFontStruct *font = NULL;
+ XFontSet fontset;
BEGINMESSAGE(makeInfoPopup)
@@ -210,14 +225,20 @@
n=0;
XtSetArg(args[n], XtNfont, &font);
n++;
+ XtSetArg(args[n], XtNfontSet, &fontset);
n++;
XtSetArg(args[n], XtNbottomMargin, &bottomMargin);
n++;
XtSetArg(args[n], XtNleftMargin, &leftMargin);
n++;
XtSetArg(args[n], XtNrightMargin, &rightMargin);
n++;
XtSetArg(args[n], XtNtopMargin, &topMargin);
n++;
XtGetValues(infotext,args,n);
- width = font->max_bounds.width * 80 + leftMargin + rightMargin;
- height = (font->ascent + font->descent) * 22 + topMargin + bottomMargin;
+ if( font != NULL ) {
+ width = font->max_bounds.width * 80 + leftMargin + rightMargin;
+ height = (font->ascent + font->descent) * 22 + topMargin + bottomMargin;
+ } else {
+ width = FontSetWidth(fontset) * 80 + leftMargin + rightMargin;
+ height = FontSetHeight(fontset) * 22 + topMargin + bottomMargin;
+ }
n=0;
XtSetArg(args[0], XtNwidth, width);
n++;
--- gv-3.5.8/src/main.c.orig 1997-06-21 07:00:00.000000000 +0900
+++ gv-3.5.8/src/main.c 2002-08-29 12:36:50.000000000 +0900
@@ -258,6 +258,7 @@
/*### initializing toolkit and the application context #################*/
INFMESSAGE(initializing toolkit and the application context)
+ XtSetLanguageProc(NULL, NULL, NULL);
XtToolkitInitialize();
app_con = XtCreateApplicationContext();
XtAppAddActions(app_con, actions, XtNumber(actions));
--- gv-3.5.8/src/misc_private.c.orig 1997-06-07 07:00:00.000000000 +0900
+++ gv-3.5.8/src/misc_private.c 2002-08-29 12:36:50.000000000 +0900
@@ -72,22 +72,29 @@
if (text) { /* most of the following comes from X11/Xaw/Label.c */
Position x,y;
INFSMESSAGE(update_label,text)
- y = w->label.label_y + w->label.font->max_bounds.ascent;
+ if(w->label.encoding) {
+ y = w->label.label_y - XExtentsOfFontSet(w->label.fontset)
+ ->max_logical_extent.y;
+ } else {
+ y = w->label.label_y + w->label.font->max_bounds.ascent;
+ }
if (w->label.justify == XtJustifyCenter) {
unsigned int width;
int len = (int) strlen(text);
- XFontStruct *fs = w->label.font;
- if (w->label.encoding) width = XTextWidth16 (fs, (XChar2b*)text,
(int)(len/2) );
- else width = XTextWidth (fs, text ,
(int)(len) );
+ if (w->label.encoding) {
+ width = XmbTextEscapement(w->label.fontset, text, (int)len );
+ } else {
+ width = XTextWidth (w->label.font, text , (int)(len)
);
+ }
x = (Position) ((w->core.width-width)/2);
} else {
x = w->label.internal_width + w->threeD.shadow_width;
}
if (w->label.encoding) {
- XDrawString16(XtDisplay(widget), XtWindow(widget),
- w->label.normal_GC,
- x, y,(XChar2b*)text, (int)(strlen(text)));
+ XmbDrawString(XtDisplay(widget), XtWindow(widget),
+ w->label.fontset, w->label.normal_GC,
+ x, y, text, (int)(strlen(text)));
} else {
XDrawString(XtDisplay(widget), XtWindow(widget),
w->label.normal_GC,
--- gv-3.5.8/src/callbacks.c.orig 2002-08-29 12:36:49.000000000 +0900
+++ gv-3.5.8/src/callbacks.c 2002-08-29 12:36:50.000000000 +0900
@@ -493,8 +493,8 @@
Widget w;
XtPointer client_data, call_data;
{
- char *prompt=GV_PRINT_MESSAGE;
- char *buttonlabel=GV_PRINT_BUTTON_LABEL;
+ char *prompt=app_res.string_printcmd;
+ char *buttonlabel=app_res.string_print;
char *message;
char *pagelist=NULL;
@@ -517,11 +517,11 @@
if (app_res.confirm_print) {
if (gv_print_mode==PAGE_MODE_MARKED) {
- message=GV_PRINT_MARKED_MESSAGE; INFMESSAGE(printing marked pages)
+ message=app_res.string_printmarked; INFMESSAGE(printing marked pages)
} else if (gv_print_mode == PAGE_MODE_CURRENT) {
- message=GV_PRINT_PAGE_MESSAGE; INFMESSAGE(printing current page)
+ message=app_res.string_printpage; INFMESSAGE(printing current page)
} else {
- message=GV_PRINT_ALL_MESSAGE; INFMESSAGE(printing document)
+ message=app_res.string_printdoc; INFMESSAGE(printing document)
}
DialogPopupSetPrompt(prompt);
DialogPopupSetMessage(message);
@@ -612,7 +612,7 @@
{
Arg args[10];
Cardinal n;
- char *title="Save";
+ char *title=app_res.string_save;
char *buttonlabel;
Widget button = XtNameToWidget(FileSel,"button2");
char *pagelist;
@@ -644,21 +644,21 @@
if (gv_save_mode==PAGE_MODE_MARKED) {
XawFileSelectionRemoveButton(FileSel, 3);
- buttonlabel="Save Marked Pages"; INFMESSAGE(saving marked pages)
+ buttonlabel=app_res.string_savemarked; INFMESSAGE(saving marked pages)
strcpy(ext,"_pages");
} else if (gv_save_mode==PAGE_MODE_CURRENT) {
XawFileSelectionRemoveButton(FileSel, 3);
- buttonlabel="Save Current Page"; INFMESSAGE(saving current page)
+ buttonlabel=app_res.string_savepage; INFMESSAGE(saving current page)
if (0<=current_page && current_page <= 9998)
sprintf(ext,"_page_%d",(current_page+1));
else strcpy(ext,"_page");
} else {
- buttonlabel="Save Document"; INFMESSAGE(saving all pages)
+ buttonlabel=app_res.string_savedoc; INFMESSAGE(saving all pages)
if (gv_filename_dsc) {
Widget button3;
XawFileSelectionAddButton(FileSel, 3, cb_doSave,
(XtPointer)FILE_TYPE_PDF);
button3 = XtNameToWidget(FileSel,"button3");
n=0;
- XtSetArg(args[n], XtNlabel, "Save as PDF"); ++n;
+ XtSetArg(args[n], XtNlabel, app_res.string_savepdf); ++n;
XtSetValues(button3,args,n);
}
}
@@ -765,10 +765,10 @@
XawFileSelectionRemoveButton(FileSel, 3);
n=0;
- XtSetArg(args[n], XtNtitle, "Open File"); ++n;
+ XtSetArg(args[n], XtNtitle, app_res.string_openfile); ++n;
XtSetValues(FileSel_popup, args, n);
n=0;
- XtSetArg(args[n], XtNlabel, "Open File"); ++n;
+ XtSetArg(args[n], XtNlabel, app_res.string_openfile); ++n;
XtSetValues(button, args, n);
XtRemoveAllCallbacks(button, XtNcallback);
XtAddCallback(button, XtNcallback,cb_doOpenFile,NULL);
@@ -1012,8 +1012,9 @@
show_page(REQUEST_TOGGLE_RESIZE,NULL);
}
if (show_autoResize) {
- if (app_res.auto_resize) XtSetArg(args[0], XtNlabel,GV_AUTO_RESIZE_YES);
- else XtSetArg(args[0], XtNlabel,GV_AUTO_RESIZE_NO);
+ //if (app_res.auto_resize) XtSetArg(args[0],
XtNlabel,GV_XtNewString(app_res.string_variablesize));
+ if (app_res.auto_resize) XtSetArg(args[0],
XtNlabel,app_res.string_autoresize_yes);
+ else XtSetArg(args[0],
XtNlabel,app_res.string_autoresize_no);
XtSetValues(w_autoResize, args,ONE);
}
widgets_setSelectedBitmap(sizeEntry, app_res.auto_resize ? 1 : 0);
--- gv-3.5.8/src/main_resources.h.orig 1997-06-07 07:00:00.000000000 +0900
+++ gv-3.5.8/src/main_resources.h 2002-08-29 12:36:50.000000000 +0900
@@ -73,6 +73,19 @@
String misc_menu;
Boolean show_title;
Boolean use_bpixmap;
+ String string_autoresize_yes;
+ String string_autoresize_no;
+ String string_openfile;
+ String string_print;
+ String string_printdoc;
+ String string_printcmd;
+ String string_printpage;
+ String string_printmarked;
+ String string_save;
+ String string_savepage;
+ String string_savemarked;
+ String string_savedoc;
+ String string_savepdf;
} AppResources;
#ifdef _GV_MAIN_C_
@@ -139,6 +152,19 @@
DECLARE_STRING(miscMenu)
DECLARE_STRING(showTitle)
DECLARE_STRING(useBackingPixmap)
+DECLARE_STRING(stringAutoResizeYes)
+DECLARE_STRING(stringAutoResizeNo)
+DECLARE_STRING(stringOpenFile)
+DECLARE_STRING(stringPrint)
+DECLARE_STRING(stringPrintDocument)
+DECLARE_STRING(stringPrintCommand)
+DECLARE_STRING(stringPrintPage)
+DECLARE_STRING(stringPrintMarked)
+DECLARE_STRING(stringSave)
+DECLARE_STRING(stringSavePage)
+DECLARE_STRING(stringSaveMarked)
+DECLARE_STRING(stringSaveDoc)
+DECLARE_STRING(stringSavePDF)
/*-------------------------------------------------------------*/
@@ -227,6 +253,32 @@
XtOffsetOf(AppResources, show_title), XtRImmediate, (XtPointer)True},
{n_useBackingPixmap,n_useBackingPixmap, XtRBoolean, sizeof(Boolean),
XtOffsetOf(AppResources, use_bpixmap), XtRImmediate, (XtPointer)True},
+ {n_stringAutoResizeYes,n_stringAutoResizeYes, XtRString, sizeof(String),
+ XtOffsetOf(AppResources, string_autoresize_yes), XtRImmediate, "Variable
Size"},
+ {n_stringAutoResizeNo,n_stringAutoResizeNo, XtRString, sizeof(String),
+ XtOffsetOf(AppResources, string_autoresize_no), XtRImmediate, "Fixed Size"},
+ {n_stringOpenFile,n_stringOpenFile, XtRString, sizeof(String),
+ XtOffsetOf(AppResources, string_openfile), XtRImmediate, "Open File"},
+ {n_stringPrint,n_stringPrint, XtRString, sizeof(String),
+ XtOffsetOf(AppResources, string_print), XtRImmediate, "Print"},
+ {n_stringPrintDocument,n_stringPrintDocument, XtRString, sizeof(String),
+ XtOffsetOf(AppResources, string_printdoc), XtRImmediate, "Print Document"},
+ {n_stringPrintCommand,n_stringPrintCommand, XtRString, sizeof(String),
+ XtOffsetOf(AppResources, string_printcmd), XtRImmediate, "Print Command:"},
+ {n_stringPrintPage,n_stringPrintPage, XtRString, sizeof(String),
+ XtOffsetOf(AppResources, string_printpage), XtRImmediate, "Print Current
Page"},
+ {n_stringPrintMarked,n_stringPrintMarked, XtRString, sizeof(String),
+ XtOffsetOf(AppResources, string_printmarked), XtRImmediate, "Print Marked
Page"},
+ {n_stringSave,n_stringSave, XtRString, sizeof(String),
+ XtOffsetOf(AppResources, string_save), XtRImmediate, "Save"},
+ {n_stringSavePage,n_stringSavePage, XtRString, sizeof(String),
+ XtOffsetOf(AppResources, string_savepage), XtRImmediate, "Save Current
Page"},
+ {n_stringSaveMarked,n_stringSaveMarked, XtRString, sizeof(String),
+ XtOffsetOf(AppResources, string_savemarked), XtRImmediate, "Save Marked
Page"},
+ {n_stringSaveDoc,n_stringSaveDoc, XtRString, sizeof(String),
+ XtOffsetOf(AppResources, string_savedoc), XtRImmediate, "Save Document"},
+ {n_stringSavePDF,n_stringSavePDF, XtRString, sizeof(String),
+ XtOffsetOf(AppResources, string_savepdf), XtRImmediate, "Save as PDF"},
};
#endif /* _GV_MAIN_C_ */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [help-gv] Old i18n patch,
Orion Poplawski <=