/**
    \fn configure
*/
bool addBorders::configure(void)
{
        uint32_t width,height;
#define MAKEME(x) uint32_t x=param.x;
        while(1)
        {
          MAKEME(left);
          MAKEME(right);
          MAKEME(top);
          MAKEME(bottom);

          width=previousFilter->getInfo()->width;
          height=previousFilter->getInfo()->height;

          diaElemUInteger dleft(&left,QT_TRANSLATE_NOOP("addBorder", "_Left border:"),       0,width);
          diaElemUInteger dright(&right,QT_TRANSLATE_NOOP("addBorder", "_Right border:"),    0,width);
          diaElemUInteger dtop(&(top),QT_TRANSLATE_NOOP("addBorder", "_Top border:"),          0,height);
          diaElemUInteger dbottom(&(bottom),QT_TRANSLATE_NOOP("addBorder", "_Bottom border:"), 0,height);

          diaElem *elems[4]={&dleft,&dright,&dtop,&dbottom};
          if(diaFactoryRun(QT_TRANSLATE_NOOP("addBorder", "Add Borders"),4,elems))
          {
            if((left&1) || (right&1)|| (top&1) || (bottom&1))
            {
              GUI_Error_HIG(QT_TRANSLATE_NOOP("addBorder", "Incorrect parameters"),QT_TRANSLATE_NOOP("addBorder", "All parameters must be even and within range."));
              continue;
            }
            else
            {
  #undef MAKEME
  #define MAKEME(x) param.x=x;
                MAKEME(left);
                MAKEME(right);
                MAKEME(top);
                MAKEME(bottom);
                info.width=width+left+right;
                info.height=height+top+bottom;
                return 1;
            }
          }
          return 0;
      }
}
Example #2
0
void dijsktra(int i, int j){
	visited[i][j] = 1;
    int dist;
    if(i+1 < M && !visited[i+1][j]){
       dist = ddown(i,j);
       dist += D[i][j];
       if(D[i+1][j] > dist){
            D[i+1][j] = dist;
            decrease_key(pointers[i+1][j]);
       }
    }
    if(j+1 < N && !visited[i][j+1]){
        dist = dright(i,j);
        dist += D[i][j];
        if(D[i][j+1] > dist){
            D[i][j+1] = dist;
            decrease_key(pointers[i][j+1]);
        }
    }

    if(i-1 >= 0 && !visited[i-1][j]){
        dist = dtop(i,j);
        dist += D[i][j];
        if(D[i-1][j] > dist){
            D[i-1][j] = dist;
            decrease_key(pointers[i-1][j]);
        }
    }

    if(j-1 >= 0 && !visited[i][j-1]){
        dist = dleft(i,j);
        dist += D[i][j];
        if(D[i][j-1] > dist){
            D[i][j-1] = dist;
            decrease_key(pointers[i][j-1]);
        }
    }
}