Skip to content

Commit

Permalink
Sidebar to panels (#42)
Browse files Browse the repository at this point in the history
* rebased

* small refresh bug on zoom tiles, with pixelminimap panel
  • Loading branch information
KorGgenT committed Mar 18, 2019
1 parent 05e7bd7 commit 2636a0e
Show file tree
Hide file tree
Showing 29 changed files with 2,273 additions and 1,164 deletions.
21 changes: 21 additions & 0 deletions data/raw/keybindings.json
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,20 @@
"name": "Select armor for moving",
"bindings": [ { "input_method": "keyboard", "key": "s" }, { "input_method": "keyboard", "key": "RETURN" } ]
},
{
"type": "keybinding",
"id": "MOVE_PANEL",
"category": "PANEL_MGMT",
"name": "Select panel for moving",
"bindings": [ { "input_method": "keyboard", "key": "s" }, { "input_method": "keyboard", "key": "RETURN" } ]
},
{
"type": "keybinding",
"id": "TOGGLE_PANEL",
"category": "PANEL_MGMT",
"name": "Toggle panel off",
"bindings": [ { "input_method": "keyboard", "key": "TAB" } ]
},
{
"type": "keybinding",
"id": "CHANGE_SIDE",
Expand Down Expand Up @@ -1823,6 +1837,13 @@
"id": "toggle_pixel_minimap",
"bindings": [ { "input_method": "keyboard", "key": "N" } ]
},
{
"type": "keybinding",
"name": "Toggle Panel Admin",
"category": "DEFAULTMODE",
"id": "toggle_panel_adm",
"bindings": [ { "input_method": "keyboard", "key": "}" } ]
},
{
"type": "keybinding",
"name": "Reload Tileset",
Expand Down
9 changes: 9 additions & 0 deletions src/action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ std::string action_ident( action_id act )
return "toggle_fullscreen";
case ACTION_TOGGLE_PIXEL_MINIMAP:
return "toggle_pixel_minimap";
case ACTION_TOGGLE_PANEL_ADM:
return "toggle_panel_adm";
case ACTION_PANEL_MGMT:
return "panel_mgmt";
case ACTION_RELOAD_TILESET:
return "reload_tileset";
case ACTION_TOGGLE_AUTO_FEATURES:
Expand Down Expand Up @@ -379,6 +383,8 @@ bool can_action_change_worldstate( const action_id act )
case ACTION_ZOOM_OUT:
case ACTION_ZOOM_IN:
case ACTION_TOGGLE_PIXEL_MINIMAP:
case ACTION_TOGGLE_PANEL_ADM:
case ACTION_PANEL_MGMT:
case ACTION_RELOAD_TILESET:
case ACTION_TIMEOUT:
case ACTION_TOGGLE_AUTO_FEATURES:
Expand Down Expand Up @@ -724,6 +730,7 @@ action_id handle_action_menu()
REGISTER_ACTION( ACTION_TOGGLE_PIXEL_MINIMAP );
REGISTER_ACTION( ACTION_RELOAD_TILESET );
#endif // TILES
REGISTER_ACTION( ACTION_TOGGLE_PANEL_ADM );
REGISTER_ACTION( ACTION_DISPLAY_SCENT );
REGISTER_ACTION( ACTION_TOGGLE_DEBUG_MODE );
} else if( category == _( "Interact" ) ) {
Expand Down Expand Up @@ -943,6 +950,8 @@ cata::optional<tripoint> choose_adjacent_highlight( const std::string &message,
}
if( highlighted ) {
wrefresh( g->w_terrain );
// prevent hiding panels when examining an object
g->draw_panels();
}

return choose_adjacent( message, allow_vertical );
Expand Down
4 changes: 4 additions & 0 deletions src/action.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ enum action_id : int {
ACTION_ITEMACTION,
/** Turn pixel minimap on/off */
ACTION_TOGGLE_PIXEL_MINIMAP,
/** Turn admin panel on/off */
ACTION_TOGGLE_PANEL_ADM,
/** panels management */
ACTION_PANEL_MGMT,
/** Reload current tileset */
ACTION_RELOAD_TILESET,
/** Turn auto features on/off */
Expand Down
2 changes: 0 additions & 2 deletions src/activity_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2302,7 +2302,6 @@ void activity_handlers::repair_item_finish( player_activity *act, player *p )

// target selection and validation.
while( act->position == INT_MIN ) {
g->draw_sidebar_messages(); // Refresh messages to show feedback.
const int pos = g->inv_for_filter( _( "Repair what?" ), [&actor, &main_tool]( const item & itm ) {
return itm.made_of_any( actor->materials ) && !itm.count_by_charges() && !itm.is_firearm() &&
&itm != &main_tool;
Expand Down Expand Up @@ -2353,7 +2352,6 @@ void activity_handlers::repair_item_finish( player_activity *act, player *p )
act->values.resize( 1 );
}
do {
g->draw_sidebar_messages();
repeat = repeat_menu( title, repeat );

if( repeat == REPEAT_CANCEL ) {
Expand Down
1 change: 1 addition & 0 deletions src/animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class basic_animation

void draw() const {
wrefresh( g->w_terrain );
g->draw_panels();

query_popup()
.wait_message( "%s", _( "Hang on a bit..." ) )
Expand Down
1 change: 1 addition & 0 deletions src/construction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,7 @@ void place_construction( const std::string &desc )
g->u.pos() + g->u.view_offset );
}
wrefresh( g->w_terrain );
g->draw_panels();

const cata::optional<tripoint> pnt_ = choose_adjacent( _( "Construct where?" ) );
if( !pnt_ ) {
Expand Down
14 changes: 5 additions & 9 deletions src/editmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ editmap::editmap()
{
width = TERMX - TERRAIN_WINDOW_TERM_WIDTH;
height = TERMY;
offsetX = g->right_sidebar ? TERRAIN_WINDOW_TERM_WIDTH - VIEW_OFFSET_X : VIEW_OFFSET_X;
offsetX = VIEW_OFFSET_X;
infoHeight = 0;
sel_ter = undefined_ter_id;
target_ter = undefined_ter_id;
Expand Down Expand Up @@ -568,6 +568,7 @@ void editmap::update_view( bool update_info )
}

wrefresh( g->w_terrain );
g->draw_panels();

if( update_info ) { // only if requested; this messes up windows layered on top
int off = 1;
Expand Down Expand Up @@ -1032,7 +1033,6 @@ int editmap::edit_ter()
}
}
} while( action != "QUIT" );
g->draw_sidebar();
return ret;
}

Expand Down Expand Up @@ -1180,7 +1180,6 @@ int editmap::edit_fld()
update_view( false );
}
} while( fmenu.ret != UILIST_CANCEL );
g->draw_sidebar();
return ret;
}

Expand Down Expand Up @@ -1266,8 +1265,6 @@ int editmap::edit_trp()
} while( action != "QUIT" );

wrefresh( w_info );

g->draw_sidebar();
return ret;
}

Expand Down Expand Up @@ -1359,8 +1356,8 @@ int editmap::edit_itm()
}
g->draw_ter( target );
wrefresh( g->w_terrain );
g->draw_panels();
} while( imenu.ret != UILIST_CANCEL );
g->draw_sidebar();
update_view( true );
} else if( ilmenu.ret == static_cast<int>( items.size() ) ) {
debug_menu::wishitem( nullptr, target.x, target.y, target.z );
Expand All @@ -1378,7 +1375,6 @@ int editmap::edit_itm()
ilmenu.refresh();
}
} while( ilmenu.ret != UILIST_CANCEL );
g->draw_sidebar();
return ret;
}

Expand Down Expand Up @@ -1542,7 +1538,7 @@ int editmap::select_shape( shapetype shape, int mode )
action = ctxt.handle_input( BLINK_SPEED );
if( action == "RESIZE" ) {
if( ! moveall ) {
const int offset = g->right_sidebar ? -16 : 16;
const int offset = 16;
uilist smenu;
smenu.text = _( "Selection type" );
smenu.w_x = ( offsetX + offset ) / 2;
Expand Down Expand Up @@ -1681,6 +1677,7 @@ int editmap::mapgen_preview( real_coords &tc, uilist &gmenu )
if( showpreview ) {
hilights["mapgentgt"].draw( *this, true );
wrefresh( g->w_terrain );
g->draw_panels();
tmpmap.reset_vehicle_cache( target.z );
for( int x = 0; x < SEEX * 2; x++ ) {
for( int y = 0; y < SEEY * 2; y++ ) {
Expand Down Expand Up @@ -2134,7 +2131,6 @@ int editmap::edit_mapgen()
mapgen_preview( tc, gmenu );
}
} while( gmenu.ret != UILIST_CANCEL );
g->draw_sidebar();
return ret;
}

Expand Down
1 change: 1 addition & 0 deletions src/faction_camp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1358,6 +1358,7 @@ bool basecamp::handle_mission( const std::string &miss_id, const std::string &mi

g->draw_ter();
wrefresh( g->w_terrain );
g->draw_panels();

return true;
}
Expand Down
Loading

0 comments on commit 2636a0e

Please sign in to comment.