Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge changes from Genevensis's fork, realign as 2.5.6 #96

Merged
merged 36 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0d0ce3c
add dpi factor
G-e-n-e-v-e-n-s-i-S Sep 12, 2024
6a04769
take margin_right into account when determining width
G-e-n-e-v-e-n-s-i-S Sep 13, 2024
14d357d
add brightness combine_blend modes
G-e-n-e-v-e-n-s-i-S Sep 13, 2024
d922002
exempt symbol-fonts from dependency checks
G-e-n-e-v-e-n-s-i-S Sep 13, 2024
9b34ae5
add get_card_styling function for export scripts
G-e-n-e-v-e-n-s-i-S Sep 16, 2024
eedcd61
fix typeline print bug
G-e-n-e-v-e-n-s-i-S Sep 16, 2024
4054443
add exists_in_package script function
G-e-n-e-v-e-n-s-i-S Sep 17, 2024
28dd64d
Update index.txt
G-e-n-e-v-e-n-s-i-S Sep 17, 2024
bd3e05c
Merge pull request #8 from G-e-n-e-v-e-n-s-i-S/brightness-combine
G-e-n-e-v-e-n-s-i-S Sep 17, 2024
7933ceb
Merge pull request #9 from G-e-n-e-v-e-n-s-i-S/dpi-scaled-render
G-e-n-e-v-e-n-s-i-S Sep 17, 2024
a4f40b6
Merge pull request #10 from G-e-n-e-v-e-n-s-i-S/get-card-styling
G-e-n-e-v-e-n-s-i-S Sep 17, 2024
dd149b3
Merge pull request #11 from G-e-n-e-v-e-n-s-i-S/margin-right-fix
G-e-n-e-v-e-n-s-i-S Sep 17, 2024
2a0ecf2
Merge pull request #12 from G-e-n-e-v-e-n-s-i-S/print-bug-fix
G-e-n-e-v-e-n-s-i-S Sep 17, 2024
7826a55
Merge pull request #13 from G-e-n-e-v-e-n-s-i-S/symbol-fonts-dep
G-e-n-e-v-e-n-s-i-S Sep 17, 2024
c956901
make combine_blend function blend alpha channels as well
G-e-n-e-v-e-n-s-i-S Sep 17, 2024
4605372
Merge pull request #14 from G-e-n-e-v-e-n-s-i-S/combine-blend-alpha
G-e-n-e-v-e-n-s-i-S Sep 17, 2024
488e54f
Update combine_image.cpp
G-e-n-e-v-e-n-s-i-S Sep 17, 2024
db2f1de
Merge pull request #15 from G-e-n-e-v-e-n-s-i-S/combine-blend-alpha
G-e-n-e-v-e-n-s-i-S Sep 17, 2024
258679b
fix width_of invocation in console not working
G-e-n-e-v-e-n-s-i-S Sep 18, 2024
fa021d8
Merge pull request #16 from G-e-n-e-v-e-n-s-i-S/console-width_of-fix
G-e-n-e-v-e-n-s-i-S Sep 18, 2024
59a184e
revert combine_blend changes
G-e-n-e-v-e-n-s-i-S Sep 22, 2024
9ffe2f0
Update preferences_window.cpp
G-e-n-e-v-e-n-s-i-S Sep 26, 2024
8d3570b
Merge branch 'haganbmj:master' into main
G-e-n-e-v-e-n-s-i-S Sep 26, 2024
b377c72
Merge pull request #17 from G-e-n-e-v-e-n-s-i-S/export-zoom-175
G-e-n-e-v-e-n-s-i-S Sep 26, 2024
39dbdf1
Merge pull request #18 from G-e-n-e-v-e-n-s-i-S/file-exists
G-e-n-e-v-e-n-s-i-S Sep 26, 2024
6d9e536
only draw text if field is editable
G-e-n-e-v-e-n-s-i-S Sep 27, 2024
f4cdc1e
Merge pull request #19 from G-e-n-e-v-e-n-s-i-S/remove-editable-text
G-e-n-e-v-e-n-s-i-S Sep 27, 2024
2387173
Add hack to fetch caption if value is empty
G-e-n-e-v-e-n-s-i-S Sep 27, 2024
0c8466c
Merge pull request #20 from G-e-n-e-v-e-n-s-i-S/info-field-hack
G-e-n-e-v-e-n-s-i-S Sep 27, 2024
67a38e0
remove checkerboard placeholder
G-e-n-e-v-e-n-s-i-S Sep 27, 2024
ad5a9e7
Merge pull request #21 from G-e-n-e-v-e-n-s-i-S/remove-editable-text
G-e-n-e-v-e-n-s-i-S Sep 27, 2024
4878b1c
Update item_list.cpp
G-e-n-e-v-e-n-s-i-S Sep 27, 2024
79a3a57
Merge pull request #22 from G-e-n-e-v-e-n-s-i-S/delete-last-card-crash
G-e-n-e-v-e-n-s-i-S Sep 27, 2024
f3cfbd0
Update parser.cpp
CajunAvenger Sep 29, 2024
564d345
Merge pull request #23 from CajunAvenger/arrow-alias
G-e-n-e-v-e-n-s-i-S Oct 1, 2024
8ab0246
Update README.md
G-e-n-e-v-e-n-s-i-S Oct 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ Magic Set Editor, or MSE for short, is a program with which you can design your

More information on https://magicseteditor.boards.net/

=======
## Main Features in the Unofficial Branch
* Fixes the "All Image" art selector list to include .jpeg images.
* Allows for the option to remove aliasing on selected art by increasing the size of the stored images in the set file.
* Adds a text filter on the style tab for Stylesheet.
* Decouples the zoom and export scales.

=======

## Dependencies

The code depends on
Expand Down
17 changes: 17 additions & 0 deletions doc/function/get_card_styling.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Function: get_card_styling

--Usage--
> get_card_styling(card, set: set)

Get the styling data of a [[type:card]].

This is for use in exporter scripts. In card scripts, use the "styling" predefined variable instead.

--Parameters--
! Parameter Type Description
| @input@ [[type:card]] The card you want to retrieve the styling data from.
| @set@ [[type:set]] The set the card belongs to. In an exporter script, this can be ommited since "set" is a predefined variable.

--Examples--
> # Retrieve the value "is foil" from the card's styling options
> card_is_foil := get_card_styling(card)["is_foil"] or else false
1 change: 1 addition & 0 deletions doc/function/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ These functions are built into the program, other [[type:function]]s can be defi

! Cards <<<
| [[fun:new_card]] Construct a new [[type:card]] object.
| [[fun:get_card_styling]] Get the styling data of a [[type:card]].

! HTML export <<<
| [[fun:to_html]] Convert [[type:tagged text]] to html.
Expand Down
319 changes: 313 additions & 6 deletions src/gfx/combine_image.cpp

Large diffs are not rendered by default.

102 changes: 102 additions & 0 deletions src/gfx/gfx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,108 @@ enum ImageCombine
, COMBINE_XOR
, COMBINE_SHADOW
, COMBINE_SYMMETRIC_OVERLAY
, COMBINE_BRIGHTNESS_TO_ALPHA
, COMBINE_DARKNESS_TO_ALPHA
, COMBINE_GREATER_THAN_5
, COMBINE_GREATER_THAN_10
, COMBINE_GREATER_THAN_15
, COMBINE_GREATER_THAN_20
, COMBINE_GREATER_THAN_25
, COMBINE_GREATER_THAN_30
, COMBINE_GREATER_THAN_35
, COMBINE_GREATER_THAN_40
, COMBINE_GREATER_THAN_45
, COMBINE_GREATER_THAN_50
, COMBINE_GREATER_THAN_55
, COMBINE_GREATER_THAN_60
, COMBINE_GREATER_THAN_65
, COMBINE_GREATER_THAN_70
, COMBINE_GREATER_THAN_75
, COMBINE_GREATER_THAN_80
, COMBINE_GREATER_THAN_85
, COMBINE_GREATER_THAN_90
, COMBINE_GREATER_THAN_95
, COMBINE_GREATER_THAN_100
, COMBINE_GREATER_THAN_105
, COMBINE_GREATER_THAN_110
, COMBINE_GREATER_THAN_115
, COMBINE_GREATER_THAN_120
, COMBINE_GREATER_THAN_125
, COMBINE_GREATER_THAN_130
, COMBINE_GREATER_THAN_135
, COMBINE_GREATER_THAN_140
, COMBINE_GREATER_THAN_145
, COMBINE_GREATER_THAN_150
, COMBINE_GREATER_THAN_155
, COMBINE_GREATER_THAN_160
, COMBINE_GREATER_THAN_165
, COMBINE_GREATER_THAN_170
, COMBINE_GREATER_THAN_175
, COMBINE_GREATER_THAN_180
, COMBINE_GREATER_THAN_185
, COMBINE_GREATER_THAN_190
, COMBINE_GREATER_THAN_195
, COMBINE_GREATER_THAN_200
, COMBINE_GREATER_THAN_205
, COMBINE_GREATER_THAN_210
, COMBINE_GREATER_THAN_215
, COMBINE_GREATER_THAN_220
, COMBINE_GREATER_THAN_225
, COMBINE_GREATER_THAN_230
, COMBINE_GREATER_THAN_235
, COMBINE_GREATER_THAN_240
, COMBINE_GREATER_THAN_245
, COMBINE_GREATER_THAN_250
, COMBINE_SMALLER_THAN_5
, COMBINE_SMALLER_THAN_10
, COMBINE_SMALLER_THAN_15
, COMBINE_SMALLER_THAN_20
, COMBINE_SMALLER_THAN_25
, COMBINE_SMALLER_THAN_30
, COMBINE_SMALLER_THAN_35
, COMBINE_SMALLER_THAN_40
, COMBINE_SMALLER_THAN_45
, COMBINE_SMALLER_THAN_50
, COMBINE_SMALLER_THAN_55
, COMBINE_SMALLER_THAN_60
, COMBINE_SMALLER_THAN_65
, COMBINE_SMALLER_THAN_70
, COMBINE_SMALLER_THAN_75
, COMBINE_SMALLER_THAN_80
, COMBINE_SMALLER_THAN_85
, COMBINE_SMALLER_THAN_90
, COMBINE_SMALLER_THAN_95
, COMBINE_SMALLER_THAN_100
, COMBINE_SMALLER_THAN_105
, COMBINE_SMALLER_THAN_110
, COMBINE_SMALLER_THAN_115
, COMBINE_SMALLER_THAN_120
, COMBINE_SMALLER_THAN_125
, COMBINE_SMALLER_THAN_130
, COMBINE_SMALLER_THAN_135
, COMBINE_SMALLER_THAN_140
, COMBINE_SMALLER_THAN_145
, COMBINE_SMALLER_THAN_150
, COMBINE_SMALLER_THAN_155
, COMBINE_SMALLER_THAN_160
, COMBINE_SMALLER_THAN_165
, COMBINE_SMALLER_THAN_170
, COMBINE_SMALLER_THAN_175
, COMBINE_SMALLER_THAN_180
, COMBINE_SMALLER_THAN_185
, COMBINE_SMALLER_THAN_190
, COMBINE_SMALLER_THAN_195
, COMBINE_SMALLER_THAN_200
, COMBINE_SMALLER_THAN_205
, COMBINE_SMALLER_THAN_210
, COMBINE_SMALLER_THAN_215
, COMBINE_SMALLER_THAN_220
, COMBINE_SMALLER_THAN_225
, COMBINE_SMALLER_THAN_230
, COMBINE_SMALLER_THAN_235
, COMBINE_SMALLER_THAN_240
, COMBINE_SMALLER_THAN_245
, COMBINE_SMALLER_THAN_250
};

/// Combine image b onto image a using some combining function.
Expand Down
4 changes: 2 additions & 2 deletions src/gui/preferences_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,14 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent)
non_normal_export->SetValue(!settings.default_stylesheet_settings.card_normal_export());
zoom_int = static_cast<int>(settings.default_stylesheet_settings.card_zoom() * 100);
zoom->SetValue(String::Format(_("%d%%"),zoom_int));
int choices[] = { 50,66,75,100,120,150,200 };
int choices[] = { 50,66,75,100,120,150,175,200 };
for (unsigned int i = 0 ; i < sizeof(choices)/sizeof(choices[0]) ; ++i) {
zoom->Append(String::Format(_("%d%%"),choices[i]));
}

export_zoom_int = static_cast<int>(settings.default_stylesheet_settings.export_zoom() * 100);
export_zoom->SetValue(String::Format(_("%d%%"), export_zoom_int));
int export_choices[] = { 50,66,75,100,120,150,200 };
int export_choices[] = { 50,66,75,100,120,150,175,200 };
for (unsigned int i = 0; i < sizeof(export_choices) / sizeof(export_choices[0]); ++i) {
export_zoom->Append(String::Format(_("%d%%"), export_choices[i]));
}
Expand Down
4 changes: 2 additions & 2 deletions src/render/value/choice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ bool prepare_choice_viewer(RotatedDC& dc, ValueViewer& viewer, ChoiceStyle& styl
img.generateCached(img_options, &style.mask, &combine, &bitmap, &image, &size);
// store content properties
if (style.content_width != size.width || style.content_height != size.height) {
style.content_width = size.width;
style.content_height = size.height;
style.content_width = size.width / dc.getZoom();
style.content_height = size.height / dc.getZoom();
return true;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/render/value/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ void ImageValueViewer::draw(RotatedDC& dc) {
if (!image.Ok() && style().default_image.isReady()) {
image = style().default_image.generate(GeneratedImage::Options(w, h, &getStylePackage(), &getLocalPackage()));
is_default = true;
if (what & DRAW_EDITING) {
bitmap = imagePlaceholder(dc, w, h, image, what & DRAW_EDITING);
if ((what & DRAW_EDITING) && field().editable) {
bitmap = imagePlaceholder(dc, w, h, image, true);
if (alpha_mask.isLoaded() || !is_rad0(a)) {
image = bitmap.ConvertToImage(); // we need to convert back to an image
} else {
Expand All @@ -54,7 +54,7 @@ void ImageValueViewer::draw(RotatedDC& dc) {
// checkerboard placeholder
if (!image.Ok() && !bitmap.Ok() && style().width > 40) {
// placeholder bitmap
bitmap = imagePlaceholder(dc, w, h, wxNullImage, what & DRAW_EDITING);
bitmap = imagePlaceholder(dc, w, h, wxNullImage, (what & DRAW_EDITING) && field().editable);
if (alpha_mask.isLoaded() || !is_rad0(a)) {
// we need to convert back to an image
image = bitmap.ConvertToImage();
Expand Down
15 changes: 12 additions & 3 deletions src/render/value/information.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@ void InfoValueViewer::draw(RotatedDC& dc) {
style().padding_top,
-style().padding_left - style().padding_right,
-style().padding_top - style().padding_bottom
);
RealSize size = dc.GetTextExtent(value().value);
dc.DrawText(value().value, align_in_rect(style().alignment, size, rect));
);
// for some reason, while inside the style tab, this value is empty
// so as a hack for now, if the value is empty, go fetch the caption instead
if (value().value.empty()) {
RealSize size = dc.GetTextExtent(field().caption.get());
dc.DrawText(field().caption.get(), align_in_rect(style().alignment, size, rect));
}
// this is what should happen
else {
RealSize size = dc.GetTextExtent(value().value);
dc.DrawText(value().value, align_in_rect(style().alignment, size, rect));
}
}
14 changes: 13 additions & 1 deletion src/script/functions/basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,17 @@ SCRIPT_FUNCTION(random_select_many) {
return ret;
}

SCRIPT_FUNCTION(get_card_styling) {
SCRIPT_PARAM_C(ScriptValueP, input);
SCRIPT_PARAM_C(ScriptValueP, set);
ScriptObject<CardP>* c = dynamic_cast<ScriptObject<CardP>*>(input.get());
ScriptObject<Set*>* s = dynamic_cast<ScriptObject<Set*>*>(set.get());
if (s && c) {
return to_script(&s->getValue()->stylingDataFor(c->getValue()));
}
throw ScriptError(_("invalid set or card argument"));
}

// ----------------------------------------------------------------------------- : Keywords


Expand Down Expand Up @@ -755,7 +766,8 @@ void init_script_basic_functions(Context& ctx) {
ctx.setVariable(_("to_color"), script_to_color);
ctx.setVariable(_("to_date"), script_to_date);
ctx.setVariable(_("to_code"), script_to_code);
ctx.setVariable(_("type_name"), script_type_name);
ctx.setVariable(_("type_name"), script_type_name);
ctx.setVariable(_("get_card_styling"), script_get_card_styling);
// math
ctx.setVariable(_("abs"), script_abs);
ctx.setVariable(_("random_real"), script_random_real);
Expand Down
6 changes: 4 additions & 2 deletions src/script/functions/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ SCRIPT_FUNCTION(to_card_image) {
// ----------------------------------------------------------------------------- : Image functions

SCRIPT_FUNCTION(width_of) {
SCRIPT_PARAM(Set*, set);
SCRIPT_PARAM(GeneratedImageP, input);
Image image = input->generate(GeneratedImage::Options());
Image image = input->generate(GeneratedImage::Options(0, 0, set->stylesheet.get()));
SCRIPT_RETURN(image.GetWidth());
}

SCRIPT_FUNCTION(height_of) {
SCRIPT_PARAM(Set*, set);
SCRIPT_PARAM(GeneratedImageP, input);
Image image = input->generate(GeneratedImage::Options());
Image image = input->generate(GeneratedImage::Options(0, 0, set->stylesheet.get()));
SCRIPT_RETURN(image.GetHeight());
}

Expand Down
6 changes: 3 additions & 3 deletions src/script/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ bool isOper (wxUniChar c) { return wxStrchr(_("+-*/!.@%^&:=<>;,"),c) != nullptr
bool isLparen(wxUniChar c) { return c==_('(') || c==_('[') || c==_('{'); }
bool isRparen(wxUniChar c) { return c==_(')') || c==_(']') || c==_('}'); }
bool isDigitOrDot(wxUniChar c) { return isDigit(c) || c==_('.'); }
bool isLongOper(StringView s) { return s==_(":=") || s==_("==") || s==_("!=") || s==_("<=") || s==_(">="); }
bool isLongOper(StringView s) { return s==_(":=") || s==_("==") || s==_("!=") || s==_("<=") || s==_(">=") || s==_("->"); }

// moveme
// ----------------------------------------------------------------------------- : Tokenizing
Expand Down Expand Up @@ -351,7 +351,7 @@ enum Precedence
{ PREC_ALL
, PREC_NEWLINE // newline ;
, PREC_SEQ // ;
, PREC_SET // :=
, PREC_SET // := ->
, PREC_AND // and or
, PREC_CMP // == != < > <= >=
, PREC_ADD // + -
Expand Down Expand Up @@ -736,7 +736,7 @@ ExprType parseOper(TokenIterator& input, Script& script, Precedence minPrec, Ins
}
script.addInstruction(I_POP); // discard result of first expression
type = parseOper(input, script, PREC_SET);
} else if (minPrec <= PREC_SET && token==_(":=")) {
} else if (minPrec <= PREC_SET && (token==_(":=") || token==_("->"))) {
// We made a mistake, the part before the := should be a variable name,
// not an expression. Remove that instruction.
Instruction& instr = script.getInstructions().back();
Expand Down
3 changes: 2 additions & 1 deletion tools/website/drupal/mse-drupal-modules/highlight.inc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ $built_in_functions = array(
'filter_list' =>'',
'random_shuffle' =>'',
'random_select' =>'',
'random_select_many' =>'',
'random_select_many' =>'',
'get_card_styling' =>'',
// keywords
'expand_keywords' =>'', 'expand_keywords_rule'=>'expand_keywords',
'keyword_usage' =>'',
Expand Down