diff options
Diffstat (limited to 'source/blender/src/buttons_editing.c')
-rw-r--r-- | source/blender/src/buttons_editing.c | 306 |
1 files changed, 306 insertions, 0 deletions
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 6e21aa2ccdb..c44d5d9b023 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -86,6 +86,7 @@ #include "BLI_arithb.h" #include "BLI_vfontdata.h" #include "BLI_editVert.h" +#include "BLI_dynstr.h" #include "BSE_filesel.h" @@ -159,6 +160,202 @@ short uv_calc_mapdir= 1, uv_calc_mapalign= 1, facesel_draw_edges= 0; extern ListBase editNurb; +/* *************************** Unicode Character Groups ****************** */ +unicodect uctabname[125] = { + {"All", "All", 0x0000, 0xffff}, + {"Basic Latin", "Basic Latin", 0x0000, 0x007f}, + {"Latin 1 Supp", "Latin-1 Supplement", 0x0080, 0x00ff}, + + {"Latin Ext. A.", "Latin Extended-A", 0x0100, 0x017F}, + {"Latin Ext. B.", "Latin Extended-B", 0x0180,0x024F}, + {"Latin Ext. Add.", "Latin Extended Additional", 0x1e00, 0x1eff}, + + {"IPA Ext", "IPA Extensions", 0x0250, 0x02AF}, + {"Spacing Mod.", "Spacing Modifier Letters", 0x02b0, 0x02ff}, + + {"Comb. Dia.", "Combining Diacritical Marks", 0x0300, 0x036F}, + {"Greek, Coptic", "Greek and Coptic", 0x0370, 0x03ff}, + {"Greek Ext.", "Greek Extended", 0x1f00, 0x1fff}, + + {"Cyrillic", "Cyrillic", 0x0400, 0x04ff}, + {"Cyrillic Supp.", "Cyrillic Supplementary", 0x0500, 0x052f}, + + {"Armenian", "Armenian", 0x0530, 0x058f}, + {"Hebrew", "Hebrew", 0x0590, 0x05ff}, + + + {"Arabic", "Arabic", 0x0600, 0x06ff}, + {"Syriac", "Syriac", 0x0700, 0x074f}, + + {"Thaana", "Thaana", 0x0780, 0x07bf}, + {"Devanagari", "Devanagari", 0x0900, 0x097f}, + + {"Bengali", "Bengali", 0x0980, 0x09ff}, + {"Gurmukhi", "Gurmukhi", 0x0a00, 0x0a7f}, + + {"Gujarati", "Gujarati", 0x0a80, 0x0aff}, + {"Oriya", "Oriya", 0x0b00, 0x0b7f}, + + {"Tamil", "Tamil", 0x0b80, 0x0bff}, + {"Tegulu", "Tegulu", 0x0c00, 0x0c7f}, + + {"Kannada", "Kannada", 0x0c80, 0x0cff}, + {"Malayalam", "Malayalam", 0x0d00, 0x0d7f}, + + {"Sinhala", "Sinhala", 0x0d80, 0x0dff}, + {"Thai", "Thai", 0x0e00, 0x0e7f}, + + {"Lao", "Lao", 0x0e80, 0x0eff}, + {"Tibetan", "Tibetan", 0x0f00, 0x0fff}, + + {"Myanmar", "Myanmar", 0x1000, 0x109f}, + {"Georgian", "Georgian", 0x10a0, 0x10ff}, + + {"Ethiopic", "Ethiopic", 0x1200, 0x137f}, + + {"Cherokee", "Cherokee", 0x13a0, 0x13ff}, + {"Unif. Canadian", "Unified Canadian Aboriginal Syllabics", 0x1400, 0x167f}, + + {"Ogham", "Ogham", 0x1680, 0x169f}, + {"Runic", "Runic", 0x16a0, 0x16ff}, + + {"Tagalog", "Tagalog", 0x1700, 0x171f}, + {"Hanunoo", "Hanunoo", 0x1720, 0x173f}, + + {"Buhid", "Buhid", 0x1740, 0x175f}, + {"Tagbanwa", "Tagbanwa", 0x1760, 0x177f}, + + {"Khmer", "Khmer", 0x1780, 0x17ff}, + {"Khmer Symb", "Khmer Symbols", 0x19e0, 0x19ff}, + + {"Mongolian", "Mongolian", 0x1800, 0x18af}, + + {"Limbu", "Limbu", 0x1900, 0x194f}, + {"Tai Le", "Tai Le", 0x1950, 0x197f}, + + {"Phon. Ext.", "Phonetic Extensions", 0x1d00, 0x1d7f}, + + + {"Gen. Punct.", "General Punctutation", 0x2000, 0x206f}, + {"Super, Sub", "Superscripts and Subscripts", 0x2070, 0x209f}, + + {"Curr. Symb.", "Currency Symbols", 0x20a0, 0x20cf}, + {"Comb. Diacrit.", "Combining Diacritical Marks for Symbols", 0x20d0, 0x20ff}, + + {"Letter Symb", "Letterlike Symbols", 0x2100, 0x214f}, + {"Numb. Forms", "Number Forms", 0x2150, 0x218f}, + + {"Arrows", "Arrows", 0x2190, 0x21ff}, + {"Math Oper.", "Mathematical Operators", 0x2200, 0x22ff}, + + {"Misc. Tech.", "Miscellaneous Technical", 0x2300, 0x23ff}, + {"Ctrl. Pict.", "Control Pictures", 0x2400, 0x243f}, + + {"OCR", "Optical Character Recognition", 0x2440, 0x245f}, + {"Enc. Alpha", "Enclosed Alphanumerics", 0x2460, 0x24ff}, + + {"Bow Drawing", "Box Drawing", 0x2500, 0x257f}, + {"BLock Elem.", "Block Elements", 0x2580, 0x259f}, + + {"Geom. Shapes", "Geometric Shapes", 0x25a0, 0x25ff}, + {"Misc. Symb.", "Miscellaneous Symbols", 0x2600, 0x26ff}, + + {"Dingbats", "Dingbats", 0x2700, 0x27bf}, + {"Misc. Math A", "Miscellaneous Mathematical Symbols-A", 0x27c0, 0x27ef}, + + {"Supp. Arrows-A", "Supplemental Arrows-A", 0x27f0, 0x27ff}, + {"Braille Pat.", "Braille Patterns", 0x2800, 0x28ff}, + + {"Supp. Arrows-B", "Supplemental Arrows-B", 0x2900, 0x297f}, + {"Misc. Math B", "Miscellaneous Mathematical Symbols-B", 0x2980, 0x29ff}, + + {"Supp. Math Op.", "Supplemental Mathematical Operators", 0x2a00, 0x2aff}, + {"Misc. Symb.", "Miscellaneous Symbols and Arrows", 0x2b00, 0x2bff}, + + {"Kangxi Rad.", "Kangxi Radicals", 0x2f00, 0x2fdf}, + + {"Ideographic", "Ideographic Description Characters", 0x2ff0, 0x2fff}, + + {"Hiragana", "Hiragana", 0x3040, 0x309f}, + {"Katakana", "Katakana", 0x30a0, 0x30ff}, + {"Katakana Ext.", "Katakana Phonetic Extensions", 0x31f0, 0x31ff}, + + {"Bopomofo", "Bopomofo", 0x3100, 0x312f}, + {"Bopomofo Ext.", "Bopomofo Extended", 0x31a0, 0x31bf}, + + {"Hangul", "Hangul Jamo", 0x1100, 0x11ff}, + {"Hangul Comp.", "Hangul Compatibility Jamo", 0x3130, 0x318f}, + {"Hangul Syll.", "Hangul Syllables", 0xac00, 0xd7af}, + + {"Kanbun", "Kanbun", 0x3190, 0x319f}, + + + + {"Yijing Hex.", "Yijing Hexagram Symbols", 0x4dc0, 0x4dff}, + + {"Yi Syllables", "Yi Syllables", 0xa000, 0xa48f}, + {"Yi Radicals", "Yi Radicals", 0xa490, 0xa4cf}, + + {"High Surr.", "High Surrogate Area", 0xd800, 0xdbff}, + + {"Low Surr.", "Low Surrogates", 0xdc00, 0xdfff}, + {"Priv. Use Area", "Private Use Area", 0xe000, 0xf8ff}, + + {"CJK Rad. Supp.", "CJK Radicals Supplement", 0x2e80, 0x2eff}, + {"CJK Ideographs", "CJK Unified Ideographs", 0x4e00, 0x9faf}, + {"CJK Ideog. Ext. A", "CJK Unified Ideographs Extension A", 0x3400, 0x4dbf}, + {"CJK Ideog. Ext. B", "CJK Unified Ideographs Extension B", 0x20000, 0x2a6df}, + {"CJK Symbols.", "CJK Symbols and Punctuation", 0x3000, 0x303f}, + {"Enclosed CJK", "Enclosed CJK Letters and Months", 0x3200, 0x32ff}, + {"CJK Comp.", "CJK Compatibility", 0x3300, 0x33ff}, + {"CJK Comp. Ideog.", "CJK Compatibility Ideographs", 0xf900, 0xfaff}, + {"CJK Comp. Forms", "CJK Compatibility Forms", 0xfe30, 0xfe4f}, + {"CJK Comp. Supp.", "CJK Compatibility Ideographs Supplement", 0x2f800, 0x2fa1f}, + + {"Alpha. Pres. Forms", "Alphabetic Presentation Forms", 0xfb00, 0xfb4f}, + + {"Arabic Pres. A", "Arabic Presentation Forms-A", 0xfb50, 0xfdff}, + {"Arabic Pres. B", "Arabic Presentation Forms-B", 0xfe70, 0xfeff}, + + {"Var. Sel.", "Variation Selectors", 0xfe00, 0xfe0f}, + + {"Comb. Half", "Combining Half Marks", 0xfe20, 0xfe2f}, + + {"Sml. From Var.", "Small Form Variants", 0xfe50, 0xfe6f}, + + {"Half, Full Forms", "Halfwidth and Fullwidth Forms", 0xff00, 0xffef}, + {"Specials", "Specials", 0xfff0, 0xffff}, + + {"Lin. B Syllab.", "Linear B Syllabary", 0x10000, 0x1007f}, + {"Lin. B Idog.", "Linear B Ideograms", 0x10080, 0x100ff}, + + {"Aegean Num.", "Aegean Numbers", 0x10100, 0x1013f}, + {"Old Italic", "Old Italic", 0x10300, 0x1032f}, + + {"Gothic", "Gothic", 0x10330, 0x1034f}, + {"Ugaritic", "Ugaritic", 0x10380, 0x1039f}, + + {"Deseret", "Deseret", 0x10400, 0x1044f}, + {"Shavian", "Shavian", 0x10450, 0x1047f}, + + {"Osmanya", "Osmanya", 0x10480, 0x104af}, + {"Cypriot Syll", "Cypriot Syllabary", 0x10800, 0x1083f}, + + {"Bysantine Mus.", "Bysantine Musical Symbols", 0x1d000, 0x1d0ff}, + {"Music Symb.", "Musical Symbols", 0x1d100, 0x1d1ff}, + + {"Tai Xuan Symb", "Tai Xuan Jing Symbols", 0x1d300, 0x1d35f}, + {"Math. Alpha Symb.", "Mathematical Alpanumeric Symbols", 0x1d400, 0x1d7ff}, + + + {"Tags", "Tags", 0xe0000, 0xe007f}, + {"Var. Supp", "Variation Selectors Supplement", 0xe0100, 0xe01ef}, + + {"Supp. Priv. A", "Supplementary Private Use Area-A", 0xf0000, 0xffffd}, + {"Supp. Priv. B", "Supplementary Private Use Area-B", 0x100000, 0x10fffd} + +}; + /* *************************** static functions prototypes ****************** */ VFont *exist_vfont(char *str); @@ -1268,6 +1465,11 @@ static void load_buts_vfont(char *name) allqueue(REDRAWBUTSEDIT, 0); } +static void set_unicode_text_fs(char *file) +{ + if (file > 0) paste_unicodeText(file); +} + void do_fontbuts(unsigned short event) { Curve *cu; @@ -1275,6 +1477,9 @@ void do_fontbuts(unsigned short event) Object *ob; ScrArea *sa; char str[80]; + int ctevt; + char *ctmenu; + DynStr *ds; int i, style=0; ob= OBACT; @@ -1422,6 +1627,74 @@ void do_fontbuts(unsigned short event) } } break; + + case B_SETCHAR: + G.charmin = 0x0000; + G.charmax = 0xffff; + if(G.charstart < 0) + G.charstart = 0; + if(G.charstart > (0xffff - 12*6)) + G.charstart = 0xffff - (12*6); + allqueue(REDRAWBUTSEDIT, 0); + break; + + case B_SETUPCHAR: + G.charstart = G.charstart - (12*6); + if(G.charstart < 0) + G.charstart = 0; + if(G.charstart < G.charmin) + G.charstart = G.charmin; + allqueue(REDRAWBUTSEDIT, 0); + break; + + case B_SETCAT: + // Create new dynamic string + ds = BLI_dynstr_new(); + + // Fill the dynamic string with entries + for(i=0;i<104;i++) + { + BLI_dynstr_append(ds, "|"); + BLI_dynstr_append(ds, uctabname[i].name); + } + + // Create the menu string from dyn string + ctmenu = BLI_dynstr_get_cstring(ds); + + // Call the popup menu + ctevt = pupmenu_col(ctmenu, 40); + G.charstart = uctabname[ctevt-1].start; + G.charmin = uctabname[ctevt-1].start; + G.charmax = uctabname[ctevt-1].end; + + // Free all data + BLI_dynstr_free(ds); + MEM_freeN(ctmenu); + + // And refresh + allqueue(REDRAWVIEW3D, 0); + allqueue(REDRAWBUTSEDIT, 0); + + break; + + case B_SETDOWNCHAR: + G.charstart = G.charstart + (12*6); + if(G.charstart > (0xffff - 12*6)) + G.charstart = 0xffff - (12*6); + if(G.charstart > G.charmax - 12*6) + G.charstart = G.charmax - 12*6; + allqueue(REDRAWBUTSEDIT, 0); + break; + + case B_SETUNITEXT: + sa= closest_bigger_area(); + areawinset(sa->win); + + if(ob==G.obedit) { + activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, set_unicode_text_fs); + } + break; + case B_TEXTONCURVE: if(ob) { cu= ob->data; @@ -1437,6 +1710,32 @@ void do_fontbuts(unsigned short event) } } +static void editing_panel_char_type(Object *ob, Curve *cu) +{ + uiBlock *block; + + block= uiNewBlock(&curarea->uiblocks, "editing_panel_char_type", UI_EMBOSS, UI_HELV, curarea->win); + uiNewPanelTabbed("Font", "Editing"); + if(uiNewPanel(curarea, block, "Char", "Editing", 640, 0, 318, 204)==0) + return; + + // Set the selected font + G.selfont = cu->vfont; + + uiDefIconBut(block, BUT, B_SETUNITEXT, ICON_TEXT, 0,210,20,20, 0, 0, 0, 0, 0, "Load Unicode Text file"); + + // Unicode categorization selection button + uiDefBut(block, BUT, B_SETCAT, "Unicode Table", 22,210,226,20, 0, 0, 0, 0, 0, "Select Unicode Table"); + uiDefButI(block, NUM, /*B_SETUPCHAR*/ 0, "", 250,210,50,20, &G.charstart, 0, 0xffff, 0, 0, "UT"); + + // Character selection button + uiDefBut(block, CHARTAB, B_SETCHAR, "", 0, 0, 264, 200, 0, 0, 0, 0, 0, "Select character"); + + // Buttons to change the max, min + uiDefButI(block, BUT, B_SETUPCHAR, "U", 280, 185, 15, 15, &G.charstart, 0, 0xffff, 0, 0, "Scroll character table up"); + uiDefButI(block, BUT, B_SETDOWNCHAR, "D", 280, 0, 15, 15, &G.charstart, 0, 0xffff, 0, 0, "Scroll character table down"); +} + static void editing_panel_font_type(Object *ob, Curve *cu) { uiBlock *block; @@ -3354,6 +3653,13 @@ void editing_panels() editing_panel_links(ob); // no editmode! editing_panel_curve_type(ob, cu); editing_panel_font_type(ob, cu); + +#ifdef INTERNATIONAL + if(G.obedit) + { + editing_panel_char_type(ob, cu); + } +#endif editing_panel_modifiers(ob); break; |