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

Remove ToolButton in favor of Button #39690

Merged
merged 1 commit into from
Jun 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion doc/classes/EditorPlugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</description>
</method>
<method name="add_control_to_bottom_panel">
<return type="ToolButton">
<return type="Button">
</return>
<argument index="0" name="control" type="Control">
</argument>
Expand Down
57 changes: 0 additions & 57 deletions doc/classes/ToolButton.xml

This file was deleted.

15 changes: 10 additions & 5 deletions editor/animation_track_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1783,7 +1783,8 @@ AnimationTimelineEdit::AnimationTimelineEdit() {
length->set_tooltip(TTR("Animation length (seconds)"));
length->connect("value_changed", callable_mp(this, &AnimationTimelineEdit::_anim_length_changed));
len_hb->add_child(length);
loop = memnew(ToolButton);
loop = memnew(Button);
loop->set_flat(true);
loop->set_tooltip(TTR("Animation Looping"));
loop->connect("pressed", callable_mp(this, &AnimationTimelineEdit::_anim_loop_pressed));
loop->set_toggle_mode(true);
Expand Down Expand Up @@ -2786,7 +2787,8 @@ Variant AnimationTrackEdit::get_drag_data(const Point2 &p_point) {
drag_data["group"] = base_path;
drag_data["index"] = track;

ToolButton *tb = memnew(ToolButton);
Button *tb = memnew(Button);
tb->set_flat(true);
tb->set_text(path_cache);
tb->set_icon(icon_cache);
set_drag_preview(tb);
Expand Down Expand Up @@ -5640,22 +5642,25 @@ AnimationTrackEditor::AnimationTrackEditor() {

bottom_hb->add_spacer();

selected_filter = memnew(ToolButton);
selected_filter = memnew(Button);
selected_filter->set_flat(true);
selected_filter->connect("pressed", callable_mp(this, &AnimationTrackEditor::_view_group_toggle)); //same function works the same
selected_filter->set_toggle_mode(true);
selected_filter->set_tooltip(TTR("Only show tracks from nodes selected in tree."));

bottom_hb->add_child(selected_filter);

view_group = memnew(ToolButton);
view_group = memnew(Button);
view_group->set_flat(true);
view_group->connect("pressed", callable_mp(this, &AnimationTrackEditor::_view_group_toggle));
view_group->set_toggle_mode(true);
view_group->set_tooltip(TTR("Group tracks by node or display them as plain list."));

bottom_hb->add_child(view_group);
bottom_hb->add_child(memnew(VSeparator));

snap = memnew(ToolButton);
snap = memnew(Button);
snap->set_flat(true);
snap->set_text(TTR("Snap:") + " ");
bottom_hb->add_child(snap);
snap->set_disabled(true);
Expand Down
9 changes: 4 additions & 5 deletions editor/animation_track_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "scene/gui/spin_box.h"
#include "scene/gui/tab_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/tool_button.h"
#include "scene/resources/animation.h"
#include "scene_tree_editor.h"

Expand All @@ -59,7 +58,7 @@ class AnimationTimelineEdit : public Range {

HBoxContainer *len_hb;
EditorSpinSlider *length;
ToolButton *loop;
Button *loop;
TextureRect *time_icon;

MenuButton *add_track;
Expand Down Expand Up @@ -310,7 +309,7 @@ class AnimationTrackEditor : public VBoxContainer {
HSlider *zoom;
EditorSpinSlider *step;
TextureRect *zoom_icon;
ToolButton *snap;
Button *snap;
OptionButton *snap_mode;

Button *imported_anim_warning;
Expand Down Expand Up @@ -457,8 +456,8 @@ class AnimationTrackEditor : public VBoxContainer {
void _anim_duplicate_keys(bool transpose);

void _view_group_toggle();
ToolButton *view_group;
ToolButton *selected_filter;
Button *view_group;
Button *selected_filter;

void _selection_changed();

Expand Down
12 changes: 8 additions & 4 deletions editor/code_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,12 +628,14 @@ FindReplaceBar::FindReplaceBar() {
hbc_button_search->add_child(matches_label);
matches_label->hide();

find_prev = memnew(ToolButton);
find_prev = memnew(Button);
find_prev->set_flat(true);
hbc_button_search->add_child(find_prev);
find_prev->set_focus_mode(FOCUS_NONE);
find_prev->connect("pressed", callable_mp(this, &FindReplaceBar::search_prev));

find_next = memnew(ToolButton);
find_next = memnew(Button);
find_next->set_flat(true);
hbc_button_search->add_child(find_next);
find_next->set_focus_mode(FOCUS_NONE);
find_next->connect("pressed", callable_mp(this, &FindReplaceBar::search_next));
Expand Down Expand Up @@ -1706,7 +1708,8 @@ CodeTextEditor::CodeTextEditor() {
error_line = 0;
error_column = 0;

toggle_scripts_button = memnew(ToolButton);
toggle_scripts_button = memnew(Button);
toggle_scripts_button->set_flat(true);
toggle_scripts_button->connect("pressed", callable_mp(this, &CodeTextEditor::_toggle_scripts_pressed));
status_bar->add_child(toggle_scripts_button);
toggle_scripts_button->hide();
Expand All @@ -1726,7 +1729,8 @@ CodeTextEditor::CodeTextEditor() {
find_replace_bar->connect("error", callable_mp(error, &Label::set_text));

// Warnings
warning_button = memnew(ToolButton);
warning_button = memnew(Button);
warning_button->set_flat(true);
status_bar->add_child(warning_button);
warning_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
warning_button->set_default_cursor_shape(CURSOR_POINTING_HAND);
Expand Down
9 changes: 4 additions & 5 deletions editor/code_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include "scene/gui/dialogs.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/text_edit.h"
#include "scene/gui/tool_button.h"
#include "scene/main/timer.h"

class GotoLineDialog : public ConfirmationDialog {
Expand All @@ -63,8 +62,8 @@ class FindReplaceBar : public HBoxContainer {

LineEdit *search_text;
Label *matches_label;
ToolButton *find_prev;
ToolButton *find_next;
Button *find_prev;
Button *find_next;
CheckBox *case_sensitive;
CheckBox *whole_words;
TextureButton *hide_button;
Expand Down Expand Up @@ -142,8 +141,8 @@ class CodeTextEditor : public VBoxContainer {
FindReplaceBar *find_replace_bar;
HBoxContainer *status_bar;

ToolButton *toggle_scripts_button;
ToolButton *warning_button;
Button *toggle_scripts_button;
Button *warning_button;
Label *warning_count_label;

Label *line_and_col_txt;
Expand Down
3 changes: 2 additions & 1 deletion editor/create_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,8 @@ Variant CreateDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
d["type"] = "create_favorite_drag";
d["class"] = ti->get_text(0);

ToolButton *tb = memnew(ToolButton);
Button *tb = memnew(Button);
tb->set_flat(true);
tb->set_icon(ti->get_icon(0));
tb->set_text(ti->get_text(0));
favorites->set_drag_preview(tb);
Expand Down
24 changes: 16 additions & 8 deletions editor/debugger/script_editor_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1517,41 +1517,47 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {

hbc->add_child(memnew(VSeparator));

skip_breakpoints = memnew(ToolButton);
skip_breakpoints = memnew(Button);
skip_breakpoints->set_flat(true);
hbc->add_child(skip_breakpoints);
skip_breakpoints->set_tooltip(TTR("Skip Breakpoints"));
skip_breakpoints->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_skip_breakpoints));

hbc->add_child(memnew(VSeparator));

copy = memnew(ToolButton);
copy = memnew(Button);
copy->set_flat(true);
hbc->add_child(copy);
copy->set_tooltip(TTR("Copy Error"));
copy->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_copy));

hbc->add_child(memnew(VSeparator));

step = memnew(ToolButton);
step = memnew(Button);
step->set_flat(true);
hbc->add_child(step);
step->set_tooltip(TTR("Step Into"));
step->set_shortcut(ED_GET_SHORTCUT("debugger/step_into"));
step->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_step));

next = memnew(ToolButton);
next = memnew(Button);
next->set_flat(true);
hbc->add_child(next);
next->set_tooltip(TTR("Step Over"));
next->set_shortcut(ED_GET_SHORTCUT("debugger/step_over"));
next->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_next));

hbc->add_child(memnew(VSeparator));

dobreak = memnew(ToolButton);
dobreak = memnew(Button);
dobreak->set_flat(true);
hbc->add_child(dobreak);
dobreak->set_tooltip(TTR("Break"));
dobreak->set_shortcut(ED_GET_SHORTCUT("debugger/break"));
dobreak->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_break));

docontinue = memnew(ToolButton);
docontinue = memnew(Button);
docontinue->set_flat(true);
hbc->add_child(docontinue);
docontinue->set_tooltip(TTR("Continue"));
docontinue->set_shortcut(ED_GET_SHORTCUT("debugger/continue"));
Expand Down Expand Up @@ -1730,9 +1736,11 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
vmem_total->set_editable(false);
vmem_total->set_custom_minimum_size(Size2(100, 0) * EDSCALE);
vmem_hb->add_child(vmem_total);
vmem_refresh = memnew(ToolButton);
vmem_refresh = memnew(Button);
vmem_refresh->set_flat(true);
vmem_hb->add_child(vmem_refresh);
vmem_export = memnew(ToolButton);
vmem_export = memnew(Button);
vmem_export->set_flat(true);
vmem_export->set_tooltip(TTR("Export list to a CSV file"));
vmem_hb->add_child(vmem_export);
vmem_vb->add_child(vmem_hb);
Expand Down
9 changes: 6 additions & 3 deletions editor/editor_audio_buses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,19 +782,22 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {

HBoxContainer *hbc = memnew(HBoxContainer);
vb->add_child(hbc);
solo = memnew(ToolButton);
solo = memnew(Button);
solo->set_flat(true);
solo->set_toggle_mode(true);
solo->set_tooltip(TTR("Solo"));
solo->set_focus_mode(FOCUS_NONE);
solo->connect("pressed", callable_mp(this, &EditorAudioBus::_solo_toggled));
hbc->add_child(solo);
mute = memnew(ToolButton);
mute = memnew(Button);
mute->set_flat(true);
mute->set_toggle_mode(true);
mute->set_tooltip(TTR("Mute"));
mute->set_focus_mode(FOCUS_NONE);
mute->connect("pressed", callable_mp(this, &EditorAudioBus::_mute_toggled));
hbc->add_child(mute);
bypass = memnew(ToolButton);
bypass = memnew(Button);
bypass->set_flat(true);
bypass->set_toggle_mode(true);
bypass->set_tooltip(TTR("Bypass"));
bypass->set_focus_mode(FOCUS_NONE);
Expand Down
1 change: 0 additions & 1 deletion editor/editor_audio_buses.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include "scene/gui/slider.h"
#include "scene/gui/texture_progress.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/tool_button.h"
#include "scene/gui/tree.h"

class EditorAudioBuses;
Expand Down
Loading