Changeset 3311 in kBuild for trunk/SlickEdit/kdev.e
- Timestamp:
- Mar 9, 2020 10:20:32 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SlickEdit/kdev.e
r3146 r3311 3545 3545 #endif 3546 3546 3547 static void kdev_ext_to_lang(_str sExt, _str idLang) 3548 { 3549 #if __VERSION__ >= 21.0 // dunno when exactly. 3550 _SetExtensionReferTo(sExt, idLang); 3551 #else 3552 replace_def_data("def-lang-for-ext-" :+ sExt, idLand); 3553 #endif 3554 } 3555 3556 #if __VERSION__ >= 21.0 3557 3558 static _str kdev_load_lexer(_str sFilename) 3559 { 3560 int rc = cload(sFilename); 3561 if (rc == 0) 3562 return ""; 3563 return ' Failed to load "' sFilename "': " rc ";"; 3564 } 3565 3566 /** Doesn't seems like there is an API to just load a bunch of profiles, only I 3567 * could find would load one named profile for a specific language, making it 3568 * the new profile for that language. So, a little extra work here. */ 3569 static _str kdev_load_beautifier_profiles(_str sFilename) 3570 { 3571 _str sRet = ''; 3572 int iStatus = 0; 3573 auto hXml = _xmlcfg_open(sFilename, iStatus); 3574 if (hXml >= 0) 3575 { 3576 _str asProfiles[]; 3577 iStatus = _xmlcfg_find_simple_array(hXml, "//profile/@n", asProfiles, TREE_ROOT_INDEX, VSXMLCFG_FIND_VALUES, -1); 3578 _xmlcfg_close(hXml); 3579 3580 _str sProfile; 3581 foreach (sProfile in asProfiles) 3582 { 3583 _str asElements[] = split2array(sProfile, '.'); 3584 _str sLangId = asElements[1]; 3585 _str sProfileName = substr(sProfile, 1 + length(asElements[0]) 3586 + 1 + length(asElements[1]) 3587 + 1 + length(asElements[2]) + 1); 3588 //say("sLangId='" sLangId "' sProfileName='" sProfileName "'; "); 3589 _str sErr = _new_beautifier_config_import_settings(sFilename, sProfileName, sLangId); 3590 if (sErr != "") 3591 sRet = ' Failed to load "' sProfileName "' for '" sLangId "' from '" sFilename "': " sRet ";"; 3592 } 3593 } 3594 else 3595 sRet = " Failed to open '" sFilename "': " hXml ";"; 3596 return sRet; 3597 } 3598 3599 #endif 3547 3600 3548 3601 /** 3549 3602 * Loads the standard bird settings. 3550 3603 */ 3551 _command void kdev_load_settings( )3604 _command void kdev_load_settings(_str sScriptDir = "") 3552 3605 { 3553 3606 typeless nt1; … … 3560 3613 _str sRest; 3561 3614 _str sTmp; 3615 _str sMsg = 'Please restart SlickEdit.'; 3616 3617 /* 3618 * Validate script dir argument. 3619 */ 3620 sScriptDir = _maybe_unquote_filename(sScriptDir); 3621 if (sScriptDir == "") 3622 { 3623 message("Need script dir argument!"); 3624 return; 3625 } 3626 if (!file_exists(sScriptDir :+ "/lexer-kmk.cfg.xml")) 3627 { 3628 message("Invalid script dir '" sScriptDir "' no lexer-kmk.cfg.xml file found!"); 3629 return; 3630 } 3562 3631 3563 3632 #if __VERSION__ >= 21.0 3564 3633 /* 3565 * Load the color profile (was lexer).3634 * Load the color profiles (was lexer). 3566 3635 */ 3567 int rc = cload(_strip_filename(__FILE__, 'N') '/user.vlx'); 3636 sMsg = sMsg :+ kdev_load_lexer(sScriptDir :+ "/lexer-kmk-v2.cfg.xml"); 3637 3638 /* 3639 * Load project templates for kBuild. 3640 */ 3641 int rc = importProjectPacks(sScriptDir :+ "/usrprjtemplates.vpt"); 3568 3642 if (rc != 0) 3569 messageNwait('cload of user.vlx failed: ' rc); 3643 sMsg = sMsg :+ " importProjectPacks(usrprjtemplates.vpt)->" :+ rc :+ ";"; 3644 3645 /* 3646 * Load the beautifier profiles. 3647 */ 3648 sMsg = sMsg :+ kdev_load_beautifier_profiles(sScriptDir :+ "/beautifier-profiles.cfg.xml"); 3649 3650 /* 3651 * Load color and select scheme. 3652 */ 3653 _str sErr = _color_form_import_settings(sScriptDir :+ "/color_profiles.cfg.xml", 'Solarized Dark'); 3654 if (sErr != "") 3655 sMsg = sMsg :+ " _color_form_import_settings(color_profiles.cfg.xml)->" :+ sErr :+ ";"; 3656 _app_theme('Dark', true); 3570 3657 #endif 3571 3658 … … 3688 3775 LanguageSettings.setSyntaxIndent(sLangId, 4); 3689 3776 3690 /* C/C++ setup, wrap at column 80 not 64. */3777 /* C/C++ setup, fixed comment width of 80 not 64, no max column. */ 3691 3778 # if __VERSION__ >= 21.0 3692 if (_LangGetPropertyInt32(sLangId, VSLANGPROPNAME_CW_FIXED_RIGHT_COLUMN) < 80) 3693 _LangSetPropertyInt32(sLangId, VSLANGPROPNAME_CW_FIXED_RIGHT_COLUMN, 80); 3779 _SetCommentWrapFlags(CW_MAX_RIGHT, false, sLangId); 3780 _SetCommentWrapFlags(CW_USE_FIXED_WIDTH, true, sLangId); 3781 if (_LangGetPropertyInt32(sLangId, VSLANGPROPNAME_CW_FIXED_WIDTH_SIZE) < 80) 3782 _LangSetPropertyInt32(sLangId, VSLANGPROPNAME_CW_FIXED_WIDTH_SIZE, 80); 3694 3783 # else 3695 3784 sTmp = LanguageSettings.getCommentWrapOptions(sLangId); … … 3736 3825 3737 3826 /* Fix .asm and add .mac, .kmk, .cmd, and .pgsql. */ 3738 replace_def_data("def-lang-for-ext-asm", 'masm');3739 replace_def_data("def-lang-for-ext-mac", 'masm');3740 replace_def_data("def-lang-for-ext-kmk", 'mak');3741 replace_def_data("def-lang-for-ext-cmd", 'bat');3742 replace_def_data("def-lang-for-ext-pgsql", 'plsql');3827 kdev_ext_to_lang("asm", 'masm'); 3828 kdev_ext_to_lang("mac", 'masm'); 3829 kdev_ext_to_lang("kmk", 'mak'); 3830 kdev_ext_to_lang("cmd", 'bat'); 3831 kdev_ext_to_lang("pgsql", 'plsql'); 3743 3832 3744 3833 /* … … 3800 3889 * */ 3801 3890 3802 message( "Please restart SlickEdit.")3891 message(sMsg) 3803 3892 } 3804 3893
Note:
See TracChangeset
for help on using the changeset viewer.