Files
renderdoc/qrenderdoc/Code/Resources.h
T
baldurk 124d0e71b6 Implement more flexible step/run options. Closes #2276 Closes #2312
* We split stepping for source debugging into step over/into/out depending on
  how it handles function calls. Step Into is the same behaviour as before - it
  steps to the next source line executed regardless of if it's inside a function
  call. Step Over is similar but will not enter function calls. We define that
  as the callstack growing (so staying the same or shrinking - returning from a
  function - is OK), and this is as accurate as the underlying debug
  information. Step Out will run until the callstack shrinks, i.e. returning
  from a function.
* This is a slight behaviour change of keyboard shortcuts - F10 was effectively
  doing step into and will now step over. F11 will step into which is the old
  behaviour.
* All these variants have backwards versions, and to remain consistent we keep
  the shift modifier as forwards/backwards. This differs from visal studio where
  step out is shift-F10.
* The seems like the best balance - using any other variant would likely confuse
  muscle memory of anyone used to visual studio (where these shortcuts are
  intended to mimick), if only because F10 would be step into whether or not F11
  is used for step over or some other key which would likely be even more
  confusing either way. Trying to twist to use Shift-F10 for step out would be
  inconsistent with the other backwards running operations and likely cause more
  confusion than it saves in matching VS's shortcuts exactly. Also an accidental
  Shift-F10 is not too destructive, the user can realise it didn't Step Out
  forwards, and press Ctrl-F10 or look up the button.
* The hope is that most likely people doing source debugging and familiar with
  these keys expect F10 to step over, so the previous behaviour was unexpected
  but easy to work around, and that changing the meaning of the key won't
  disrupt them. Or at least the disruption is less than other alternatives.
2021-07-21 13:39:26 +01:00

164 lines
8.8 KiB
C++

/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2019-2021 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#pragma once
#include <QIcon>
#include <QPixmap>
#include <QWidget>
#define RESOURCE_LIST() \
RESOURCE_DEF(add, "add.png") \
RESOURCE_DEF(arrow_in, "arrow_in.png") \
RESOURCE_DEF(arrow_join, "arrow_join.png") \
RESOURCE_DEF(arrow_left, "arrow_left.png") \
RESOURCE_DEF(arrow_refresh, "arrow_refresh.png") \
RESOURCE_DEF(arrow_right, "arrow_right.png") \
RESOURCE_DEF(arrow_undo, "arrow_undo.png") \
RESOURCE_DEF(asterisk_orange, "asterisk_orange.png") \
RESOURCE_DEF(bug, "bug.png") \
RESOURCE_DEF(chart_curve, "chart_curve.png") \
RESOURCE_DEF(cog, "cog.png") \
RESOURCE_DEF(color_wheel, "color_wheel.png") \
RESOURCE_DEF(copy, "copy.png") \
RESOURCE_DEF(connect, "connect.png") \
RESOURCE_DEF(control_base_blue, "control_base_blue.png") \
RESOURCE_DEF(control_cursor_blue, "control_cursor_blue.png") \
RESOURCE_DEF(control_end_blue, "control_end_blue.png") \
RESOURCE_DEF(control_play_blue, "control_play_blue.png") \
RESOURCE_DEF(control_nan_blue, "control_nan_blue.png") \
RESOURCE_DEF(control_reverse_blue, "control_reverse_blue.png") \
RESOURCE_DEF(control_reverse_base_blue, "control_reverse_base_blue.png") \
RESOURCE_DEF(control_reverse_cursor_blue, "control_reverse_cursor_blue.png") \
RESOURCE_DEF(control_reverse_nan_blue, "control_reverse_nan_blue.png") \
RESOURCE_DEF(control_reverse_sample_blue, "control_reverse_sample_blue.png") \
RESOURCE_DEF(control_sample_blue, "control_sample_blue.png") \
RESOURCE_DEF(control_start_blue, "control_start_blue.png") \
RESOURCE_DEF(cross, "cross.png") \
RESOURCE_DEF(checkerboard, "checkerboard.png") \
RESOURCE_DEF(cut, "cut.png") \
RESOURCE_DEF(del, "del.png") \
RESOURCE_DEF(disconnect, "disconnect.png") \
RESOURCE_DEF(find, "find.png") \
RESOURCE_DEF(filter, "filter.png") \
RESOURCE_DEF(filter_reapply, "filter_reapply.png") \
RESOURCE_DEF(arrow_out, "arrow_out.png") \
RESOURCE_DEF(flag_green, "flag_green.png") \
RESOURCE_DEF(flip_y, "flip_y.png") \
RESOURCE_DEF(folder, "folder.png") \
RESOURCE_DEF(folder_page_white, "folder_page_white.png") \
RESOURCE_DEF(hourglass, "hourglass.png") \
RESOURCE_DEF(house, "house.png") \
RESOURCE_DEF(information, "information.png") \
RESOURCE_DEF(link, "link.png") \
RESOURCE_DEF(page_go, "page_go.png") \
RESOURCE_DEF(page_white_code, "page_white_code.png") \
RESOURCE_DEF(page_white_database, "page_white_database.png") \
RESOURCE_DEF(page_white_delete, "page_white_delete.png") \
RESOURCE_DEF(page_white_edit, "page_white_edit.png") \
RESOURCE_DEF(page_white_link, "page_white_link.png") \
RESOURCE_DEF(page_white_stack, "page_white_stack.png") \
RESOURCE_DEF(paste, "paste.png") \
RESOURCE_DEF(pixel_history, "pixel_history.png") \
RESOURCE_DEF(plugin, "plugin.png") \
RESOURCE_DEF(plugin_add, "plugin_add.png") \
RESOURCE_DEF(save, "save.png") \
RESOURCE_DEF(text_add, "text_add.png") \
RESOURCE_DEF(tick, "tick.png") \
RESOURCE_DEF(time, "time.png") \
RESOURCE_DEF(timeline_marker, "timeline_marker.png") \
RESOURCE_DEF(upfolder, "upfolder.png") \
RESOURCE_DEF(update, "update.png") \
RESOURCE_DEF(wand, "wand.png") \
RESOURCE_DEF(wireframe_mesh, "wireframe_mesh.png") \
RESOURCE_DEF(wrench, "wrench.png") \
RESOURCE_DEF(zoom, "zoom.png") \
RESOURCE_DEF(topo_linelist, "topologies/topo_linelist.svg") \
RESOURCE_DEF(topo_linelist_adj, "topologies/topo_linelist_adj.svg") \
RESOURCE_DEF(topo_linestrip, "topologies/topo_linestrip.svg") \
RESOURCE_DEF(topo_linestrip_adj, "topologies/topo_linestrip_adj.svg") \
RESOURCE_DEF(topo_patch, "topologies/topo_patch.svg") \
RESOURCE_DEF(topo_pointlist, "topologies/topo_pointlist.svg") \
RESOURCE_DEF(topo_trilist, "topologies/topo_trilist.svg") \
RESOURCE_DEF(topo_trilist_adj, "topologies/topo_trilist_adj.svg") \
RESOURCE_DEF(topo_tristrip, "topologies/topo_tristrip.svg") \
RESOURCE_DEF(topo_tristrip_adj, "topologies/topo_tristrip_adj.svg") \
RESOURCE_DEF(action, "action.png") \
RESOURCE_DEF(action_hover, "action_hover.png")
struct Resource
{
QIcon icon;
QPixmap pixmap;
};
class Resources
{
public:
static void Initialise();
~Resources();
#undef RESOURCE_DEF
#define RESOURCE_DEF(name, filename) \
static const Resource &name() { return resources->name##_data; } \
static const Resource &name##_2x() { return resources->name##_2x_data; }
RESOURCE_LIST()
private:
#undef RESOURCE_DEF
#define RESOURCE_DEF(name, filename) Resource name##_data, name##_2x_data;
struct ResourceSet
{
RESOURCE_LIST();
};
static ResourceSet *resources;
};
// helper forwarding structs
struct Pixmaps
{
#undef RESOURCE_DEF
#define RESOURCE_DEF(name, filename) \
static const QPixmap &name(int devicePixelRatio) \
{ \
if(devicePixelRatio == 1) \
return Resources::name().pixmap; \
else \
return Resources::name##_2x().pixmap; \
} \
static const QPixmap &name(QWidget *widget) { return name(widget->devicePixelRatio()); }
RESOURCE_LIST()
};
struct Icons
{
#undef RESOURCE_DEF
#define RESOURCE_DEF(name, filename) \
static const QIcon &name() { return Resources::name().icon; }
RESOURCE_LIST()
};