Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-01-01 03:18:23 +0300
committerJoshua Leung <aligorith@gmail.com>2009-01-01 03:18:23 +0300
commitc2de1373d1c61815e3030f88c196e6c42cb1c5fc (patch)
treea5947fea741d57578066e3e7623bfccd67638b3e /source/blender/editors/interface/view2d.c
parentea42e70cb98713571704b2a48fd88cffc7bcbfb8 (diff)
2.5:
First commit for 2009! Started of porting of Animation Editor Channels stuff. This code will be used for both the Action and IPO editors, so any existing code involving this has now been moved to the Animation module. * Added mouse-click operator for this channels view. Note: the selection stuff currently uses temporary toggling code only (i.e. it only toggles the selection of the channels in the editor, but does not update status of rest of database). * Fixed bugs in View2D listview functions. Reduced the amount of code needed, and makes the code here simpler. * Renamed action_edit_keyframes.c to action_edit.c, since channels are not handled there anymore. * Dopesheet now refreshes correctly when object selection elsewhere changes.
Diffstat (limited to 'source/blender/editors/interface/view2d.c')
-rw-r--r--source/blender/editors/interface/view2d.c54
1 files changed, 9 insertions, 45 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index ffacbab0ff6..4d6068a97ae 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -1576,8 +1576,9 @@ void UI_view2d_scrollers_free(View2DScrollers *scrollers)
void UI_view2d_listview_get_cell(View2D *v2d, short columnwidth, short rowheight, float startx, float starty,
float viewx, float viewy, int *column, int *row)
{
- const int x= (int)(floor(viewx + 0.5f) - startx);
- const int y= (int)(floor(viewy + 0.5f) - starty);
+ /* adjust view coordinates to be all positive ints, corrected for the start offset */
+ const int x= (int)(floor(fabs(viewx) + 0.5f) - startx);
+ const int y= (int)(floor(fabs(viewy) + 0.5f) - starty);
/* sizes must not be negative */
if ( (v2d == NULL) || ((columnwidth <= 0) && (rowheight <= 0)) ) {
@@ -1589,28 +1590,10 @@ void UI_view2d_listview_get_cell(View2D *v2d, short columnwidth, short rowheight
/* get column */
if ((column) && (columnwidth > 0)) {
- /* which way to get column depends on the alignment of the 'tot' rect
- * - we favour positive-x here, as that's the recommended configuration for listviews
- */
- if ((v2d->align & V2D_ALIGN_NO_NEG_X) && !(v2d->align & V2D_ALIGN_NO_POS_X)) {
- /* contents are in positive-x half */
- if (x > 0)
- *column= x % columnwidth;
- else
- *column= 0;
- }
- else if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) {
- /* contents are in negative-x half */
- if (x < 0)
- *column= (-x) % columnwidth;
- else
- *column= 0;
- }
- else {
- /* contents are centered around x==0 */
- // temp case for now...
+ if (x > 0)
+ *column= x / columnwidth;
+ else
*column= 0;
- }
}
else if (column) {
/* we want the column, but column width is undefined */
@@ -1619,29 +1602,10 @@ void UI_view2d_listview_get_cell(View2D *v2d, short columnwidth, short rowheight
/* get row */
if ((row) && (rowheight > 0)) {
- /* which way to get column depends on the alignment of the 'tot' rect
- * - we favour negative-y here, as that's the recommended configuration for listviews
- */
- if ((v2d->align & V2D_ALIGN_NO_POS_Y) && !(v2d->align & V2D_ALIGN_NO_NEG_Y)) {
- /* contents are in negative-y half */
- if (y < 0)
- *row= (-y) % rowheight;
- else
- *row= 0;
- }
- else if ((v2d->align & V2D_ALIGN_NO_NEG_Y) && !(v2d->align & V2D_ALIGN_NO_POS_Y)) {
- /* contents are in positive-y half */
- if (y > 0)
- *row= y % rowheight;
- else
- *row= 0;
- }
- else {
- /* contents are centered around y==0 */
- // temp case for now...
+ if (y > 0)
+ *row= y / rowheight;
+ else
*row= 0;
-
- }
}
else if (row) {
/* we want the row, but row height is undefined */