Esempio n. 1
0
static void IconFormScrollLines(Int16 lines)
{
	ScrollBarPtr    barP;
    Int16           valueP, minP, maxP, pageSizeP;
    Int16           newValue;
	FormPtr			frm = FrmGetActiveForm();

    barP = GetObjectPtr(IconSelectScrollBar);
    SclGetScrollBar(barP, &valueP, &minP, &maxP, &pageSizeP);

    //scroll up
    if(lines < 0)
    {
        //we are at the start
        if(valueP == minP)
            return;

        newValue = valueP + lines;
        if(newValue < minP)
            newValue = minP;
    }
    else
    {
        if(valueP == maxP)
            return;

        newValue = valueP + lines;
        if(newValue  > maxP) 
            newValue = maxP;
    }

    SclSetScrollBar(barP, newValue, minP, maxP, pageSizeP);
    IconFormScroll(newValue, valueP);
}
Esempio n. 2
0
void UpdateScrollbar(DmOpenRef db)
{
	FormPtr form = FrmGetActiveForm();
	if (FormIsNot(form, FormMain)) return;
	ScrollBarPtr scrollbar = (ScrollBarPtr) GetObjectPtr(form, SMSScroll);
	SclSetScrollBar(scrollbar, g_CurrentPage, 0, PrivPageCount(db), 1);
}
Esempio n. 3
0
/***********************************************************************
 *
 * FUNCTION:    ThumbnailViewUpdateScrollers
 *
 * DESCRIPTION: This routine draws or erases the thumbnail view scroll arrow
 *              buttons.
 *
 * PARAMETERS:  frm          -  pointer to the to do thumbnail form
 *
 * RETURNED:    nothing
 *
 ***********************************************************************/
void ThumbnailViewUpdateScrollers(FormPtr frm) {
  UInt16 pos, maxValue;

  if (d.records_in_cat > recordsPerPage) {
    pos = d.top_row_pos_in_cat / recordsPerRow;
    maxValue = (d.records_in_cat - recordsPerPage) / recordsPerRow;
    if ((d.records_in_cat - recordsPerPage) % recordsPerRow)
      maxValue++;
  } else {
    pos = 0;
    maxValue = 0;
  }

  SclSetScrollBar(GetObjectPointer(frm, ScrollBar), pos, 0, maxValue,
          recordsPerPage / recordsPerRow);
}
Esempio n. 4
0
static void
SeekScrollBar(scl_seek_t to)
{
  static Int16 pageSize = -1;
  Int16 scroll_max;

  if (pageSize == -1)
    pageSize = notelist.rect.extent.y/FntCharHeight();

  scroll_max = (notelist.num > pageSize)? notelist.num - pageSize : 0;

  notelist.firstDisplaying = (to == SCL_BEGIN)? 0 : scroll_max;

  SclSetScrollBar (GetObjectFromActiveForm(ID_EditorNoteScrollBar),
		   notelist.firstDisplaying /*pos*/, 0 /*min*/,
		   scroll_max, pageSize);
}
Esempio n. 5
0
File: screen.cpp Progetto: Jaxo/yaxx
/*---------------------------------------------------------------updateScroll-+
|                                                                             |
+----------------------------------------------------------------------------*/
void updateScroll()
{
   FormPtr frm = FrmGetActiveForm();
   FieldPtr field = (FieldPtr)FrmGetObjectPtr(
      frm,
      FrmGetObjectIndex(frm, MainConsoleField)
   );
   ScrollBarPtr scroll = (ScrollBarPtr)FrmGetObjectPtr(
      frm,
      FrmGetObjectIndex(frm,MainConsoleScrollBar)
   );
   UInt16 currentPosition, textHeight, fieldHeight, maxValue;

   FldGetScrollValues(field, &currentPosition, &textHeight, &fieldHeight);
   if (textHeight > fieldHeight) {
      maxValue = textHeight - fieldHeight;
   }else {
      maxValue = 0;
   }
   SclSetScrollBar(scroll, currentPosition, 0, maxValue, fieldHeight - 1);
}
Esempio n. 6
0
void UpdateScrollbar( Word fldindex, Word sbarindex )
{
	FormPtr frm=FrmGetActiveForm();
	FieldPtr fld;
	ScrollBarPtr scroll;
	Word currentPosition;
	Word textHeight;
	Word fieldHeight;
	Word maxValue;

	fld = FrmGetObjectPtr( frm, FrmGetObjectIndex( frm, fldindex ) );
	FldGetScrollValues( fld, &currentPosition, &textHeight, &fieldHeight );

	if( textHeight>fieldHeight )
		maxValue = textHeight - fieldHeight;
	else if( currentPosition )
		maxValue = currentPosition;
	else
		maxValue = 0;

	scroll = FrmGetObjectPtr( frm, FrmGetObjectIndex( frm, sbarindex ) );

	SclSetScrollBar( scroll, currentPosition, 0, maxValue, fieldHeight-1 );
}
Esempio n. 7
0
Boolean IconSelectHandleEvent(EventPtr eventP)
{
   	Boolean handled = false;
   	FormPtr frmP = FrmGetActiveForm();
    Int16   num;
	ScrollBarPtr barP;

	switch (eventP->eType) 
    {
    case menuEvent:
        return handled;
			
    case frmOpenEvent:
        FrmDrawForm(frmP);
        num = LoadIcon(0);

        barP = GetObjectPtr(IconSelectScrollBar);
        if (num > 9*8) {
            SclSetScrollBar(barP, 0, 0, num/8-8, 9);
        }
        else {
            SclSetScrollBar(barP, 0, 0, 0, 9);
        }
        handled = true;
        break;
			
    case ctlSelectEvent:
    	IconSelectCancelPressed = false;
        if (eventP->data.ctlSelect.controlID >= IconSelectIcon1Button &&
            eventP->data.ctlSelect.controlID < IconSelectIcon1Button+9*8) {
            Int16   val, min, max, page;
            DmResID resID;

            SclGetScrollBar(GetObjectPtr(IconSelectScrollBar),
                            &val, &min, &max, &page);

            DmResourceInfo(IconDB, (val*8+ eventP->data.ctlSelect.controlID - IconSelectIcon1Button),
                           NULL, &resID, NULL);
			g_prefs.iconNumber = resID;                           
        }
        switch (eventP->data.ctlSelect.controlID) {
        case IconSelectNoneButton:
            g_prefs.iconNumber = -1;
            break;
        case IconSelectCancelButton:
        	IconSelectCancelPressed = true;
            break;
        }

        // FrmUpdateForm(NewTodoForm, frmRedrawUpdateCode+1);
        // FrmUpdateForm(NewEventForm, frmRedrawUpdateCode+1);
        FrmReturnToForm(0);
        
        handled = true;
        break;

	case sclRepeatEvent:
		IconFormScroll(eventP->data.sclRepeat.newValue, 
                       eventP->data.sclRepeat.value);
		break;

    case keyDownEvent: 
    {
		Int16		valueP, minP, maxP, pageSizeP;

		ScrollBarPtr barP = GetObjectPtr(IconSelectScrollBar);
		SclGetScrollBar(barP, &valueP, &minP, &maxP, &pageSizeP);

		switch (eventP->data.keyDown.chr) {
		case vchrPageUp:
		case vchrPrevField:
			IconFormScrollLines(-(pageSizeP-1));
			break;
		case vchrPageDown:
		case vchrNextField:
			IconFormScrollLines((pageSizeP-1));
			handled = true;
			break;
        }
        break;
    }
        
    default:
        break;
		
    }
	
	return handled;
}