static void clickButton(int b)
{
    if (!blackout)
    {
        if (menu)
        {
            change_set(b, false);
            return;
        }
        
        if (size > 3)
        {
            size /= 3;
            if (b == TOP)
            end -= 2*size;
            else if (b == MID)
            {
                top += size;
                end -= size;
            }
            else if (b == BOT)
            top += 2*size;
        }
        else
        {
            text_buffer[pos++] = master[top+b];
            text_layer_set_text(wordsYouWrite, text_buffer);
            change_set(cur_set, false);
            next();
        }
        
        drawSides();
    }
    
}
示例#2
0
    void on_lbutton_end_drag(viewport::control& Viewport, const GdkEventButton& Event)
    {
        k3d::rectangle selection_rectangle;
        if(k3d::inode* const rubber_band = k3d::ngui::selection::state(m_document_state.document()).rubber_band())
        {
            selection_rectangle = k3d::property::pipeline_value<k3d::rectangle>(*rubber_band, "rectangle");
            selection_rectangle.y1 = Viewport.get_height() - selection_rectangle.y1;
            selection_rectangle.y2 = Viewport.get_height() - selection_rectangle.y2;
            k3d::property::set_internal_value(*rubber_band, "camera", static_cast<k3d::inode*>(0));
        }

        k3d::icrop_window* const crop_window = dynamic_cast<k3d::icrop_window*>(Viewport.camera());
        return_if_fail(crop_window);

        const k3d::rectangle box = k3d::rectangle::normalize(selection_rectangle);
        const k3d::point2 top_left = widget_to_ndc(Viewport, k3d::point2(box.x1, box.y1));
        const k3d::point2 bottom_right = widget_to_ndc(Viewport, k3d::point2(box.x2, box.y2));

        k3d::record_state_change_set change_set(m_document_state.document(), _("Set Camera Crop Window"), K3D_CHANGE_SET_CONTEXT);

        const double left = top_left[0];
        const double right = bottom_right[0];
        const double top = top_left[1];
        const double bottom = bottom_right[1];

        k3d::property::set_internal_value(crop_window->crop_left(), left);
        k3d::property::set_internal_value(crop_window->crop_right(), right);
        k3d::property::set_internal_value(crop_window->crop_top(), top);
        k3d::property::set_internal_value(crop_window->crop_bottom(), bottom);
    }
static bool common_long(int b)
{
    if (menu)
    {
        change_set(b, true);
        return true;
    }
    return false;
}
示例#4
0
static void clickButton(int b)
{
  if (!blackout)
  {
    if (menu)
    {
      change_set(b, false);
      return;
    }
    
    if (size > 3)
    {
      size /= 3;
      if (b == TOP)
      end -= 2*size;
      else if (b == MID)
      {
        top += size;
        end -= size;
      }
      else if (b == BOT)
      top += 2*size;
    }
    else
    {
      text_buffer[pos++] = master[top+b];
      if(pos==DESCRIPTION_LENGTH)
        --pos;
      drawNotepadText();
      change_set(cur_set, false);
      next();
    }
    
    drawSides();
  }
  refresh_timeout();
}
static void clickButton(int b)
{
    if (menu)
    {
        change_set(b, false);
        return;
    }

    if (size > 3)
    {
        size /= 3;
        if (b == TOP)
            end -= 2*size;
        else if (b == MID)
        {
            top += size;
            end -= size;
        }
        else if (b == BOT)
            top += 2*size;
    }
    else
    {
        // Prevent overflowing
        if (pos == MAX_CHARS-1)
            pos--;

        // Type the character
        text_buffer[pos++] = master[top+b];
        drawNotepadText();
        change_set(cur_set, false);
        next();
    }

    drawSides();
}
示例#6
0
    void on_lbutton_double_click(viewport::control& Viewport, const GdkEventButton& Event)
    {
        // If the user double-clicks outside the current crop window, reset it to render the entire frame ...
        k3d::icrop_window* const crop_window = dynamic_cast<k3d::icrop_window*>(Viewport.camera());
        if(crop_window)
        {
            const k3d::rectangle window(
                k3d::property::pipeline_value<double>(crop_window->crop_left()),
                k3d::property::pipeline_value<double>(crop_window->crop_right()),
                k3d::property::pipeline_value<double>(crop_window->crop_top()),
                k3d::property::pipeline_value<double>(crop_window->crop_bottom())
            );

            if(!window.contains(widget_to_ndc(Viewport, k3d::point2(Event.x, Event.y))))
            {
                k3d::record_state_change_set change_set(m_document_state.document(), _("Reset Camera Crop Window"), K3D_CHANGE_SET_CONTEXT);
                k3d::property::set_internal_value(crop_window->crop_left(), 0.0);
                k3d::property::set_internal_value(crop_window->crop_right(), 1.0);
                k3d::property::set_internal_value(crop_window->crop_top(), 0.0);
                k3d::property::set_internal_value(crop_window->crop_bottom(), 1.0);

                return;
            }
        }

        // Otherwise, render a preview ...
        k3d::icamera* camera = Viewport.camera();
        if(!camera)
            camera = pick_camera(m_document_state);
        if(!camera)
            return;

        k3d::irender_camera_preview* render_engine = Viewport.camera_preview_engine();
        if(!render_engine)
            render_engine = pick_camera_preview_render_engine(m_document_state);
        if(!render_engine)
            return;

        Viewport.set_camera(camera);
        Viewport.set_camera_preview_engine(render_engine);

        render(*camera, *render_engine);
    }