void MapEditor::mouseLeft(int x, int y) { // check if the custom map was clicked if(inBounds(x,y,customMap->limit)) { coordToIndex(&x,&y,customMap); selectedCellX = x; selectedCellY = y; selectedCell = customMap->getTile(selectedCellX,selectedCellY); if(selectedCell == NULL) { selectedCellX = -1; selectedCellY = -1; } else { // copy a graphic tile to the background or foreground of a cell if(selectedTileIndex != -1) { if(selectedCell->b == -1) selectedCell->b = selectedTileIndex; else if(selectedCell->b != selectedTileIndex) selectedCell->f = selectedTileIndex; } } } // check if a graphic tile was clicked, if so select it for copying else if(inBounds(x,y,tileSet->limit)) { coordToIndex(&x,&y,tileSet); selectedTileX = x; selectedTileY = y; selectedTileIndex = getTileArrayIndex(x,y); } else if(saveBtn.inBounds(x,y)) { if(currentMapFilename != NULL) { customMap->save(currentMapFilename); } } else if(closeBtn.inBounds(x,y)) { signalCompletion(); } // check if the scrolling arrows were pressed else { checkButtons(x,y,customMapBtns,customMap); checkButtons(x,y,tileSetBtns,tileSet); } }
void ClipTracksRight(int x) { int i,idx, idx1, n_val, len; Trace *trc; double sdiff; if (Mode_align) { /* get secs offset */ trc=traces[lowTrkIndex]; /* don't use 0! it might not get scaled if not exposed */ len= tracks[0]->width-x; sdiff= (trc->axis.hs*len)/trc->wave->info.sample_rate; /* adjust Total Seconds */ TotalSeconds-=sdiff; late_time = st_add_dtime(earl_time, TotalSeconds * USECS_PER_SEC); for(i=0; i <= LastTrack; i++) { trc= traces[i]; n_val=trc->wave->info.n_values-1; idx= coordToIndex(&trc->axis, x, 1); trc->axis.ix2=idx; idx1= trc->axis.ix1; if (auto_demean) { demean_trace(trc->wave,&trc->axis,idx1,idx); } RescaleTrace(trc, tracks[0]->height, tracks[0]->width); trc->zaxis_needScale= 1; trc->zaxis.ymax= trc->zaxis.y1= trc->axis.ymax; trc->zaxis.ymin= trc->zaxis.y2= trc->axis.ymin; #if 0 trc->zaxis.vs= trc->zaxis.hs= 0; #endif } }else { for(i=0; i <= LastTrack; i++) { trc= traces[i]; n_val=trc->wave->info.n_values-1; idx= coordToIndex(&trc->axis, x, 1); trc->axis.ix2= idx; RescaleTrace(trc, tracks[0]->height, tracks[0]->width); trc->zaxis_needScale= 1; } } if(ZoomWindowMapped) { for(i=lowZTrkIndex; i<= highZTrkIndex; i++) { Trace *trc=traces[i]; fixZtrkBounds(trc, trc->zaxis.ix2-trc->zaxis.ix1); } RedrawZoomWindow("ClipTracksRight"); } RedrawScreen(); }
void MapEditor::mouseRight(int x, int y) { // deselect a graphic tile if one is selected if(selectedTileX != -1 || selectedTileY != -1 || selectedTileIndex != -1) { selectedTileX = -1; selectedTileY = -1; selectedTileIndex = -1; } // deselect a custom map tile if one is selected else if(selectedCell != NULL || selectedCellX != -1 || selectedCellY != -1) { selectedCell = NULL; selectedCellX = -1; selectedCellY = -1; } // erase a layer of a custom map tile. else if(inBounds(x,y,customMap->limit)) { coordToIndex(&x,&y,customMap); Tile *tempCell = customMap->getTile(x,y); if(tempCell != NULL) { if(tempCell->f != -1) tempCell->f = -1; else tempCell->b = -1; } } }
/********************************************************************** * Clipping * **********************************************************************/ void ClipTracksLeft(int x) { int i,idx, idx2; Trace *trc; double sdiff; if (Mode_align) { /* get secs offset */ trc=traces[lowTrkIndex]; /* don't use trace 0, might not scaled */ sdiff= (double)(trc->axis.hs*x)/trc->wave->info.sample_rate; earl_time = st_add_dtime(earl_time, sdiff * USECS_PER_SEC); /* adjust Total Seconds */ TotalSeconds = st_tdiff(late_time,earl_time); for(i=0; i <= LastTrack; i++) { trc= traces[i]; idx = coordToIndex(&trc->axis, x, 1); trc->axis.ix1=idx; idx2= trc->axis.ix2; if(idx2<trc->wave->info.n_values && auto_demean) { demean_trace(trc->wave,&trc->axis,idx,idx2); } RescaleTrace(trc, tracks[0]->height, tracks[0]->width); trc->zaxis_needScale= 1; trc->zaxis.ymax= trc->zaxis.y1= trc->axis.ymax; trc->zaxis.ymin= trc->zaxis.y2= trc->axis.ymin; #if 0 trc->zaxis.vs= trc->zaxis.hs= 0; #endif } }else { for(i=0; i <= LastTrack; i++) { trc= traces[i]; idx= coordToIndex(&trc->axis, x, 1); trc->axis.ix1=idx; RescaleTrace(trc, tracks[0]->height, tracks[0]->width); } } if(ZoomWindowMapped) { for(i=lowZTrkIndex; i<= highZTrkIndex; i++) { Trace *trc=traces[i]; fixZtrkBounds(trc, trc->zaxis.ix2-trc->zaxis.ix1); } RedrawZoomWindow("ClipTracksLeft"); } RedrawScreen(); }