Changed left and right unit scrolling

This commit is contained in:
jsalmon3 2002-06-17 21:39:54 +00:00
parent 995a776050
commit ed22df12aa
3 changed files with 9 additions and 4 deletions

View file

@ -100,6 +100,7 @@ enum _mode_buttons_ {
global char** EditorUnitTypes; /// Sorted editor unit-type table
local int UnitIndex; /// Unit icon draw index
global int MaxUnitIndex; /// Max unit icon draw index
local int CursorUnitIndex; /// Unit icon under cursor
local int SelectedUnitIndex; /// Unit type to draw
@ -956,8 +957,8 @@ local void EditorCallbackButtonDown(unsigned button __attribute__ ((unused)))
&& TheUI.ButtonPanelY + 4 < CursorY
&& CursorY < TheUI.ButtonPanelY + 24) {
for (i = 9; i-- && UnitIndex;) {
--UnitIndex;
if (UnitIndex - 9 >= 0) {
UnitIndex -= 9;
}
return;
}
@ -966,8 +967,8 @@ local void EditorCallbackButtonDown(unsigned button __attribute__ ((unused)))
&& TheUI.ButtonPanelY + 4 < CursorY
&& CursorY < TheUI.ButtonPanelY + 24) {
for (i = 9; i-- && EditorUnitTypes[UnitIndex + 1];) {
++UnitIndex;
if (UnitIndex + 9 <= MaxUnitIndex) {
UnitIndex += 9;
}
return;
}
@ -1552,6 +1553,7 @@ local void CreateEditor(void)
for (i = 0; i < n; ++i) {
EditorUnitTypes[i] = UnitTypeWcNames[i];
}
MaxUnitIndex = n-1;
}
if( 1 ) {

View file

@ -70,6 +70,7 @@ local SCM CclDefineEditorUnitTypes(SCM list)
//
i=gh_length(list);
EditorUnitTypes=cp=malloc((i+1)*sizeof(char*));
MaxUnitIndex = i;
while( i-- ) {
*cp++=gh_scm2newstr(gh_car(list),NULL);
list=gh_cdr(list);

View file

@ -40,6 +40,8 @@ extern const char* EditorStartFile;
extern char** EditorUnitTypes; /// Sorted editor unit-type table
extern int MaxUnitIndex; /// Max unit icon draw index
/*----------------------------------------------------------------------------
-- Functions
----------------------------------------------------------------------------*/