1012
1012
/* 1, 2, 3, 4 */
1013
{ { L, T, R, T }, 0xf, STYLE_BORDER_TOP },
1014
{ { L, B, R, B }, 0xf, STYLE_BORDER_BOTTOM },
1015
{ { L, T, L, B }, 0xf, STYLE_BORDER_LEFT },
1016
{ { R, T, R, B }, 0xf, STYLE_BORDER_RIGHT },
1013
{ { L, T, R, T }, 0xf, GNM_STYLE_BORDER_TOP },
1014
{ { L, B, R, B }, 0xf, GNM_STYLE_BORDER_BOTTOM },
1015
{ { L, T, L, B }, 0xf, GNM_STYLE_BORDER_LEFT },
1016
{ { R, T, R, B }, 0xf, GNM_STYLE_BORDER_RIGHT },
1018
1018
/* Only for state 2 & 4 */
1019
{ { L, H, R, H }, 0xa, STYLE_BORDER_HORIZ },
1019
{ { L, H, R, H }, 0xa, GNM_STYLE_BORDER_HORIZ },
1021
1021
/* Only for state 3 & 4 */
1022
{ { V, T, V, B }, 0xc, STYLE_BORDER_VERT },
1022
{ { V, T, V, B }, 0xc, GNM_STYLE_BORDER_VERT },
1024
1024
/* Only for state 1 & 4 */
1025
{ { L, T, R, B }, 0x9, STYLE_BORDER_REV_DIAG },
1026
{ { L, B, R, T }, 0x9, STYLE_BORDER_DIAG},
1025
{ { L, T, R, B }, 0x9, GNM_STYLE_BORDER_REV_DIAG },
1026
{ { L, B, R, T }, 0x9, GNM_STYLE_BORDER_DIAG},
1028
1028
/* Only for state 2 */
1029
{ { L, T, R, H }, 0x2, STYLE_BORDER_REV_DIAG },
1030
{ { L, H, R, B }, 0x2, STYLE_BORDER_REV_DIAG },
1031
{ { L, H, R, T }, 0x2, STYLE_BORDER_DIAG },
1032
{ { L, B, R, H }, 0x2, STYLE_BORDER_DIAG },
1029
{ { L, T, R, H }, 0x2, GNM_STYLE_BORDER_REV_DIAG },
1030
{ { L, H, R, B }, 0x2, GNM_STYLE_BORDER_REV_DIAG },
1031
{ { L, H, R, T }, 0x2, GNM_STYLE_BORDER_DIAG },
1032
{ { L, B, R, H }, 0x2, GNM_STYLE_BORDER_DIAG },
1034
1034
/* Only for state 3 */
1035
{ { L, T, V, B }, 0x4, STYLE_BORDER_REV_DIAG },
1036
{ { V, T, R, B }, 0x4, STYLE_BORDER_REV_DIAG },
1037
{ { L, B, V, T }, 0x4, STYLE_BORDER_DIAG },
1038
{ { V, B, R, T }, 0x4, STYLE_BORDER_DIAG },
1035
{ { L, T, V, B }, 0x4, GNM_STYLE_BORDER_REV_DIAG },
1036
{ { V, T, R, B }, 0x4, GNM_STYLE_BORDER_REV_DIAG },
1037
{ { L, B, V, T }, 0x4, GNM_STYLE_BORDER_DIAG },
1038
{ { V, B, R, T }, 0x4, GNM_STYLE_BORDER_DIAG },
1040
1040
/* Only for state 4 */
1041
{ { L, H, V, B }, 0x8, STYLE_BORDER_REV_DIAG },
1042
{ { V, T, R, H }, 0x8, STYLE_BORDER_REV_DIAG },
1043
{ { L, H, V, T }, 0x8, STYLE_BORDER_DIAG },
1044
{ { V, B, R, H }, 0x8, STYLE_BORDER_DIAG },
1041
{ { L, H, V, B }, 0x8, GNM_STYLE_BORDER_REV_DIAG },
1042
{ { V, T, R, H }, 0x8, GNM_STYLE_BORDER_REV_DIAG },
1043
{ { L, H, V, T }, 0x8, GNM_STYLE_BORDER_DIAG },
1044
{ { V, B, R, H }, 0x8, GNM_STYLE_BORDER_DIAG },
1046
1046
{ { 0., 0., 0., 0. }, 0, 0 }
1049
1049
static GnmBorder *
1050
border_get_mstyle (FormatState const *state, StyleBorderLocation const loc)
1050
border_get_mstyle (FormatState const *state, GnmStyleBorderLocation const loc)
1052
1052
BorderPicker const *edge = & state->border.edge[loc];
1053
1053
GnmColor *color;
1150
1150
/* The edges are always there */
1151
if (x <= L+5.) which = STYLE_BORDER_LEFT;
1152
else if (y <= T+5.) which = STYLE_BORDER_TOP;
1153
else if (y >= B-5.) which = STYLE_BORDER_BOTTOM;
1154
else if (x >= R-5.) which = STYLE_BORDER_RIGHT;
1151
if (x <= L+5.) which = GNM_STYLE_BORDER_LEFT;
1152
else if (y <= T+5.) which = GNM_STYLE_BORDER_TOP;
1153
else if (y >= B-5.) which = GNM_STYLE_BORDER_BOTTOM;
1154
else if (x >= R-5.) which = GNM_STYLE_BORDER_RIGHT;
1155
1155
else switch (state->selection_mask) {
1157
1157
if ((x < V) == (y < H))
1158
which = STYLE_BORDER_REV_DIAG;
1158
which = GNM_STYLE_BORDER_REV_DIAG;
1160
which = STYLE_BORDER_DIAG;
1160
which = GNM_STYLE_BORDER_DIAG;
1163
1163
if (H-5. < y && y < H+5.)
1164
which = STYLE_BORDER_HORIZ;
1164
which = GNM_STYLE_BORDER_HORIZ;
1166
1166
/* Map everything back to the top */
1167
1167
if (y > H) y -= H-10.;
1169
1169
if ((x < V) == (y < H/2.))
1170
which = STYLE_BORDER_REV_DIAG;
1170
which = GNM_STYLE_BORDER_REV_DIAG;
1172
which = STYLE_BORDER_DIAG;
1172
which = GNM_STYLE_BORDER_DIAG;
1176
1176
if (V-5. < x && x < V+5.)
1177
which = STYLE_BORDER_VERT;
1177
which = GNM_STYLE_BORDER_VERT;
1179
1179
/* Map everything back to the left */
1180
1180
if (x > V) x -= V-10.;
1182
1182
if ((x < V/2.) == (y < H))
1183
which = STYLE_BORDER_REV_DIAG;
1183
which = GNM_STYLE_BORDER_REV_DIAG;
1185
which = STYLE_BORDER_DIAG;
1185
which = GNM_STYLE_BORDER_DIAG;
1189
1189
if (V-5. < x && x < V+5.)
1190
which = STYLE_BORDER_VERT;
1190
which = GNM_STYLE_BORDER_VERT;
1191
1191
else if (H-5. < y && y < H+5.)
1192
which = STYLE_BORDER_HORIZ;
1192
which = GNM_STYLE_BORDER_HORIZ;
1194
1194
/* Map everything back to the 1st quadrant */
1195
1195
if (x > V) x -= V-10.;
1196
1196
if (y > H) y -= H-10.;
1198
1198
if ((x < V/2.) == (y < H/2.))
1199
which = STYLE_BORDER_REV_DIAG;
1199
which = GNM_STYLE_BORDER_REV_DIAG;
1201
which = STYLE_BORDER_DIAG;
1201
which = GNM_STYLE_BORDER_DIAG;
1943
1943
cb_fmt_dialog_dialog_buttons (GtkWidget *btn, FormatState *state)
1946
static StyleBorderLocation const bmap_ltr[] = {
1947
STYLE_BORDER_TOP, STYLE_BORDER_BOTTOM,
1948
STYLE_BORDER_LEFT, STYLE_BORDER_RIGHT,
1949
STYLE_BORDER_REV_DIAG, STYLE_BORDER_DIAG,
1950
STYLE_BORDER_HORIZ, STYLE_BORDER_VERT
1952
static StyleBorderLocation const bmap_rtl[] = {
1953
STYLE_BORDER_TOP, STYLE_BORDER_BOTTOM,
1955
STYLE_BORDER_RIGHT, STYLE_BORDER_LEFT,
1957
STYLE_BORDER_DIAG, STYLE_BORDER_REV_DIAG,
1958
STYLE_BORDER_HORIZ, STYLE_BORDER_VERT
1960
StyleBorderLocation const *bmap = bmap_ltr;
1946
static GnmStyleBorderLocation const bmap_ltr[] = {
1947
GNM_STYLE_BORDER_TOP, GNM_STYLE_BORDER_BOTTOM,
1948
GNM_STYLE_BORDER_LEFT, GNM_STYLE_BORDER_RIGHT,
1949
GNM_STYLE_BORDER_REV_DIAG, GNM_STYLE_BORDER_DIAG,
1950
GNM_STYLE_BORDER_HORIZ, GNM_STYLE_BORDER_VERT
1952
static GnmStyleBorderLocation const bmap_rtl[] = {
1953
GNM_STYLE_BORDER_TOP, GNM_STYLE_BORDER_BOTTOM,
1955
GNM_STYLE_BORDER_RIGHT, GNM_STYLE_BORDER_LEFT,
1957
GNM_STYLE_BORDER_DIAG, GNM_STYLE_BORDER_REV_DIAG,
1958
GNM_STYLE_BORDER_HORIZ, GNM_STYLE_BORDER_VERT
1960
GnmStyleBorderLocation const *bmap = bmap_ltr;
1962
1962
if (NULL != state->sheet && state->sheet->text_is_rtl)
1963
1963
bmap = bmap_rtl;
1966
1966
if (btn == state->apply_button || btn == state->ok_button) {
1967
GnmBorder *borders[STYLE_BORDER_EDGE_MAX];
1967
GnmBorder *borders[GNM_STYLE_BORDER_EDGE_MAX];
1970
1970
if (state->validation.changed)
2076
2076
static struct {
2077
2077
char const *const name;
2078
StyleBorderType const pattern;
2078
GnmStyleBorderType const pattern;
2079
2079
} const line_pattern_buttons[] = {
2080
{ "line_pattern_none", STYLE_BORDER_NONE },
2081
{ "line_pattern_medium_dash_dot_dot", STYLE_BORDER_MEDIUM_DASH_DOT_DOT },
2083
{ "line_pattern_hair", STYLE_BORDER_HAIR },
2084
{ "line_pattern_slant", STYLE_BORDER_SLANTED_DASH_DOT },
2086
{ "line_pattern_dotted", STYLE_BORDER_DOTTED },
2087
{ "line_pattern_medium_dash_dot", STYLE_BORDER_MEDIUM_DASH_DOT },
2089
{ "line_pattern_dash_dot_dot", STYLE_BORDER_DASH_DOT_DOT },
2090
{ "line_pattern_medium_dash", STYLE_BORDER_MEDIUM_DASH },
2092
{ "line_pattern_dash_dot", STYLE_BORDER_DASH_DOT },
2093
{ "line_pattern_medium", STYLE_BORDER_MEDIUM },
2095
{ "line_pattern_dashed", STYLE_BORDER_DASHED },
2096
{ "line_pattern_thick", STYLE_BORDER_THICK },
2098
{ "line_pattern_thin", STYLE_BORDER_THIN },
2099
{ "line_pattern_double", STYLE_BORDER_DOUBLE },
2080
{ "line_pattern_none", GNM_STYLE_BORDER_NONE },
2081
{ "line_pattern_medium_dash_dot_dot", GNM_STYLE_BORDER_MEDIUM_DASH_DOT_DOT },
2083
{ "line_pattern_hair", GNM_STYLE_BORDER_HAIR },
2084
{ "line_pattern_slant", GNM_STYLE_BORDER_SLANTED_DASH_DOT },
2086
{ "line_pattern_dotted", GNM_STYLE_BORDER_DOTTED },
2087
{ "line_pattern_medium_dash_dot", GNM_STYLE_BORDER_MEDIUM_DASH_DOT },
2089
{ "line_pattern_dash_dot_dot", GNM_STYLE_BORDER_DASH_DOT_DOT },
2090
{ "line_pattern_medium_dash", GNM_STYLE_BORDER_MEDIUM_DASH },
2092
{ "line_pattern_dash_dot", GNM_STYLE_BORDER_DASH_DOT },
2093
{ "line_pattern_medium", GNM_STYLE_BORDER_MEDIUM },
2095
{ "line_pattern_dashed", GNM_STYLE_BORDER_DASHED },
2096
{ "line_pattern_thick", GNM_STYLE_BORDER_THICK },
2098
{ "line_pattern_thin", GNM_STYLE_BORDER_THIN },
2099
{ "line_pattern_double", GNM_STYLE_BORDER_DOUBLE },