# Main FTE Configuration File

# operating system is now defined by CFTE

# OS_UNIX, OS_OS2, OS_DOS32, OS_NT

# uncomment for appropriate keybindings and menus

%define(UI_KB)
%define(UI_FTE)
#%define(UI_WS)
#%define(UI_NE)
#%define(UI_BRIEF)
# experimental

%if(!BSD_BRACE)
%define(1TBS_BRACE)
%endif

#%define(COLORS_GRAY_BG)
#%define(COLORS_WHITE_BG)
%define(COLORS_BLACK_BG)
#%define(COLORS_BLUE_BG)

%if(OS_OS2)
%define(GUI_PM)
%endif

%if(OS_UNIX)
%define(GUI_X11)
%endif

# to customize FTE to your preferences you should only need
# to add stuff in this file.
# Some examples are below. If you find something that cannot be
# configured here, tell me about it.
# If you wish to modify only a specific mode, add customizations
# at the end of file. To also modify all of the descendants,
# put customizations right after the include statement for mode.

# The current hierarchy of modes is:
# PLAIN
#   TEXT
#     MSG
#   C
#   ...
#   BIN

# The order of things in this file is important! If you change a setting
# before the default is set in one of the included files, your
# setting will have no effect.
# The file is processed in one pass, so everything should be defined,
# before it is used.

# My ultimate goal is to have the default files unmodifiable and
# have all customization done here, but this is not currently possible for
# all things (menus come to mind).

include 'global.fte';

include 'pal_base.fte';

#color_palette {
#    { 'Comment', 'green:black' },
#}

%if(COLORS_BLACK_BG)
%if(UI_KB)
include 'pal_b_kb.fte';
%endif
include 'pal_blk.fte';
%endif

%if(COLORS_WHITE_BG)
include 'pal_wht.fte';
%endif

%if(COLORS_GRAY_BG)
include 'pal_gray.fte';
%endif

%if(COLORS_BLUE_BG)
include 'pal_blue.fte';
%endif

%if(COLORS_BLUEZ_BG)
include 'pal_bluez.fte'; # alternate blue from andyz @ sf.net
%endif

object GLOBAL {
# fonts for GUI version

%if(GUI_PM)
# PM
# Only System VIO fonts are used. Some listed below. XX*YY.
#    WindowFont =  "8x8";
#    WindowFont = "6x10";
#    WindowFont = "8x10";
#    WindowFont = "5x12";
#    WindowFont = "8x12";
#    WindowFont = "6x14";
    WindowFont = "8x14";
#    WindowFont = "5x16";
#    WindowFont = "8x16";
#    WindowFont = "8x18";

%endif

%if(GUI_X11)
# X11
# Any fixed-width font should do. Make sure it has all 256 characters
# defined or weird things can happen.

#    WindowFont = "fixed";
#    WindowFont = "6x8";
#    WindowFont = "7x13";
#    WindowFont = "8x13";
#    WindowFont = "9x15";
    WindowFont = "9x15";

# Terminus font example:
#    WindowFont = "*-terminus-medium-*-14*";
# JMK font examples:
#    WindowFont = "*-neep-medium-*-15*";
#    WindowFont = "*-neep alt-medium-*-15*";
# Misc bold font example:
#    WindowFont = "*-fixed-bold-*-15*,*-fixed-bold-*-16*";

# We need some font, which can be 'LOCALIZED' - and this can't be done
# with font names like 9x15 (actually we can, but this would need
# highly skilled users :))
#    WindowFont = "10x20";
%endif
}

include 'color.fte';

# change background color
# must be here to be inherited by other modes
# object PLAIN { color { { 'Background', '17' } }; }


# in this mode are declared all basic values
# these are inherited in other modes - so basicaly
# change only necessary values in submodes 
include 'm_plain.fte';

# must be here to be inherited by other modes

# UNIX files have no CR at the end of line

%if(OS_UNIX)
mode PLAIN {
    # Don't autodetect line separator
    DetectLineSep = 0;
    # Don't add CR at EOL when saving
    AddCR      = 0;
    # Don't remove CR if at EOL when loading
    StripChar  = -1;
}
%endif

eventmap TEX: PLAIN {
    key [F9] {
        Compile "latex " #. $FileName
    }
}

include 'm_4gl.fte';
include 'm_a51.fte';
include 'm_ada.fte';
include 'm_asm.fte';
include 'm_asm370.fte';
include 'm_bin.fte';
include 'm_c.fte';
include 'm_catbs.fte';
include 'm_clario.fte';
include 'm_diff.fte';
include 'm_ebnf.fte';
include 'm_fort90.fte';
include 'm_fte.fte';
include 'm_gawk.fte';
include 'm_html.fte';
include 'm_idl.fte';
include 'm_ipf.fte';
include 'm_java.fte';
include 'm_ldsgml.fte';
include 'm_make.fte';
include 'm_merge.fte';
include 'm_mod3.fte';
include 'm_msg.fte';
include 'm_pascal.fte';
include 'm_perl.fte';
include 'm_php.fte';
include 'm_py.fte';
include 'm_resdlg.fte';
include 'm_rexx.fte';
include 'm_rst.fte';
include 'm_ruby.fte';
include 'm_sgml.fte';
include 'm_sh.fte';
include 'm_siod.fte';
include 'm_sl.fte';
include 'm_sml.fte';
include 'm_sql.fte';
include 'm_tcl.fte';
include 'm_tex.fte';
include 'm_texi.fte';
include 'm_text.fte';
include 'm_unrealscript.fte';
include 'm_xml.fte';
include 'm_xslt.fte';

# C indentation style menu
include 'uicstyle.fte';

# When doing large customizations of keyboard/menus
# you should probably write your own version of these files.

# to change a menu, predefine it before including the ui_*.fte file.
# to add/override keybindings add them after including ui_*.fte file.

# ui*.fte -files define all keyboard bindings and menus.
# pick only one file.
%if(UI_FTE)
include 'ui_fte.fte'; # fte CUA style bindings
%endif
%if(UI_WS)
include 'ui_ws.fte';  # wordstar like
%endif
%if(UI_NE)
include 'ui_ne.fte';  # norton classic editor - incomplete
%endif
%if(UI_MEW)
include 'ui_mew.fte'; # MultiEdit4Windows
%endif
%if(UI_BRIEF)
include 'ui_brief.fte'; # BRIEF/CRISP
%endif
##include 'ui_vi.fte';  # VI - very incomplete
# todo: brief, epm, emacs, VI

# some templates and abbreviations
include 'ab_c.fte';
%if(OS_OS2)
include 'ab_c_os2.fte';
%endif
include 'ab_rexx.fte';
include 'ab_sh.fte';
include 'ab_java.fte';
include 'ab_perl.fte';

# some customizations

object GLOBAL {
    SelectPathname = 0;
    ShowToolBar = 1;     # PM only
    GUIDialogs = 1;      # PM only
    SysClipboard = 1;    # use PM clipboard, or X11 selection for clipboard
#    PMDisableAccel      = 0;   # disable Alt+Fx PM accelerators
}

# some editors have a SmartPaste feature.  We can do that too.
#eventmap C { key [S+G-Ins] { BlockPasteStream; BlockReIndent } }

eventmap PLAIN {
    key [A+S+-] { # select block between {}()[]<>
        BlockUnmark; BlockMarkStream; MatchBracket; BlockMarkStream;
        SavePos; MoveBlockEnd;
        2:MoveNext; ?MoveLeft;  # do this to mark a newline after })>]
        BlockEnd; MoveSavedPos;
    }

    key [A+C+F] { IndentFunction }
    key [A+C+M] { BlockMarkFunction }
    key [A+C+[] { MoveFunctionPrev }
    key [A+C+\]] { MoveFunctionNext }

    key [C+F1] { ShowHelpWord
%if(OS_OS2)
        # OS/2 - helpfile (can be contatenated)
        "CPREF+PMWIN+PMMSG+PMGPI+PMREL+PMFUN+PMHOK"
%endif
%if(OS_UNIX)
# UNIX - specify options to MAN
        ""
%endif
%if(OS_NT)
            # Win32 - helpfile
            #        ""
%endif
    }
%if(OS_OS2)
    key [S+F1] { ShowHelpWord "EMXDEV+EMXGNU+EMXLIB+EMXRT+EMXBSD" }
%if(!UI_BRIEF)
    key [F1] { ShowHelp "FTE" "" }
%endif
%endif

    #key [C+A+F1] {
    #    InsertString $FileName
    #    InsertString $FilePath
    #    InsertString $CurDirectory
    #}
    key [C+A+U] {
        MoveLineStart; ?FindReplace /^\/\/  / // "xnc"; MoveDown
        #MoveLineStart; ?FindReplace /^(\s*)\/\// /\1/ "xnc"; MoveDown
    }
    key [C+A+C] {
        MoveLineStart; ?FindReplace /^(\s*)/ /\/\/  \1/ "xnc"; MoveDown
        #MoveLineStart; ?FindReplace /^(\s*)\/\// /\1/ "xnc";
        #MoveLineStart; ?FindReplace /^(\s*)/ /\1\/\// "xnc"; MoveDown
    }
    key [G-Home] { MoveBeginOrNonWhite }
    key [C+G-Up] { PopGlobalBookmark }
    key [C+G-Down] { PushGlobalBookmark }
    #key [C+A+S+F] {
    #    LineNew;
    #    InsertString "path:" . $FilePath; LineNew;
    #    InsertString "name:" . $FileName; LineNew;
    #    InsertString "dir:"  . $FileDirectory; LineNew;
    #    InsertString "base:" . $FileBaseName; LineNew;.
    #    InsertString "ext:"  . $FileExtension; LineNew;
    #}
}



#and here is my function noumlaut:

sub noumlaut {
    PlaceBookmark "0";
    ?FindReplace /ä/ /\"a/ "agn" ;
    ?FindReplace /ö/ /\"o/ "agn" ;
    ?FindReplace /ü/ /\"u/ "agn" ;
    ?FindReplace /Ä/ /\"A/ "agn" ;
    ?FindReplace /Ö/ /\"O/ "agn" ;
    ?FindReplace /Ü/ /\"U/ "agn" ;
    ?FindReplace /ß/ /{\ss}/ "agn" ;
    GotoBookmark "0";
}

object GLOBAL {
#    SevenBit = 1;  # seven bit characters only for user interface...
}
eventmap PLAIN {
#left arrow at the beginning of line moves to previous line
#   key [G-Left] { MovePrev }
#right arrow at the end of line moves to next line
#   key [G-Right] { MoveNext }
    key [A+C+Enter] { noumlaut; RunProgram "latex " . $FileName; }
}
