summaryrefslogtreecommitdiff
path: root/draw_outputdev.cpp
blob: 12320c23ffdd9785510d46ac18568c9fdcd9d98e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#include <X11/Xlib.h>
#include <string.h>
#include "ldmicro.h"
#include <iostream>

//unsigned long ColorSize;
SyntaxHighlightingColours HighlightColours;

Font FixedWidthFont;
Font FixedWidthFontBold;

XColor toRGB(unsigned long red, unsigned long green, unsigned long blue)
{
    XColor temp;
    temp.red=(short)(red*65535/255);
    temp.green=(short)(green*65535/255);
    temp.blue=(short)(blue*65535/255);
    temp.pixel=((red * ColorSize * ColorSize) | (green * ColorSize)
     | (blue));
    return temp;
}

static void SetSyntaxHighlightingColours(void)
{
    static const SyntaxHighlightingColours Schemes[] = {
        {
            toRGB(0, 0, 0),           // bg
            toRGB(255, 255, 225),     // def
            toRGB(255, 110, 90),      // selected
            toRGB(255, 150, 90),      // op
            toRGB(255, 255, 100),     // punct
            toRGB(255, 160, 160),     // lit
            toRGB(120, 255, 130),     // name
            toRGB(130, 130, 130),     // rungNum
            toRGB(130, 130, 245),     // comment

            toRGB(255, 255, 255),     // bus

            toRGB(0, 0, 0),           // simBg
            toRGB(130, 130, 130),     // simRungNum
            toRGB(100, 130, 130),     // simOff
            toRGB(255, 150, 150),     // simOn

            toRGB(255, 150, 150),     // simBusLeft
            toRGB(150, 150, 255),     // simBusRight
        },
    };

    memcpy(&HighlightColours, &Schemes[0], sizeof(Schemes[0]));
}

void InitForDrawing(void)
{
    SetSyntaxHighlightingColours();
/*   FixedWidthFont.font = 
    FixedWidthFont = CreateFont(
        FONT_HEIGHT, FONT_WIDTH,
        0, 0,
        FW_REGULAR,
        FALSE,
        FALSE,
        FALSE,
        ANSI_CHARSET,
        OUT_DEFAULT_PRECIS,
        CLIP_DEFAULT_PRECIS,
        DEFAULT_QUALITY,
        FF_DONTCARE,
        "Lucida Console");

    FixedWidthFontBold = CreateFont(
        FONT_HEIGHT, FONT_WIDTH,
        0, 0,
        FW_REGULAR, // the bold text renders funny under Vista
        FALSE,
        FALSE,
        FALSE,
        ANSI_CHARSET,
        OUT_DEFAULT_PRECIS,
        CLIP_DEFAULT_PRECIS,
        DEFAULT_QUALITY,
        FF_DONTCARE,
        "Lucida Console");

    LOGBRUSH lb;
    lb.lbStyle = BS_SOLID;
    lb.lbColor = HighlightColours.simBusRight;
    BusRightBus = CreateBrushIndirect(&lb);

    lb.lbColor = HighlightColours.simBusLeft;
    BusLeftBrush = CreateBrushIndirect(&lb);

    lb.lbColor = HighlightColours.bus;
    BusBrush = CreateBrushIndirect(&lb);

    lb.lbColor = HighlightColours.bg;
    BgBrush = CreateBrushIndirect(&lb);

    lb.lbColor = HighlightColours.simBg;
    SimBgBrush = CreateBrushIndirect(&lb);*/
}