Esempio n. 1
0
File: gui-misc.c Progetto: bert/pcb
/* ---------------------------------------------------------------------------
 * output of cursor position
 */
void
ghid_set_cursor_position_labels (void)
{
  gchar *text;

  if (Marked.status)
    {
      Coord dx = Crosshair.X - Marked.X;
      Coord dy = Crosshair.Y - Marked.Y;
      Coord r  = Distance (Crosshair.X, Crosshair.Y, Marked.X, Marked.Y);
      double a = atan2 (dy, dx) * RAD_TO_DEG;

      text = pcb_g_strdup_printf (_("%m+r %-mS;\nphi %-.1f;\n%-mS %-mS"),
                                  Settings.grid_unit->allow,
                                  r, a, dx, dy);
      ghid_cursor_position_relative_label_set_text (text);
      g_free (text);
    }
  else
    ghid_cursor_position_relative_label_set_text (_("r __.__;\nphi __._;\n__.__ __.__"));


  text = pcb_g_strdup_printf (_("%m+%-mS %-mS"),
                              Settings.grid_unit->allow,
                              Crosshair.X, Crosshair.Y);
  ghid_cursor_position_label_set_text (text);
  g_free (text);
}
Esempio n. 2
0
File: gui-misc.c Progetto: bert/pcb
/* ---------------------------------------------------------------------------
 * output of status line
 */
void
ghid_set_status_line_label (void)
{
  gchar *flag = TEST_FLAG (ALLDIRECTIONFLAG, PCB)
                ? "all"
                : (PCB->Clipping == 0
                    ? "45"
                    : (PCB->Clipping == 1
                      ? "45_/"
                      : "45\\_"));
  gchar *text = pcb_g_strdup_printf (
        _("%m+<b>view</b>=%s  "
          "<b>grid</b>=%$mS  "
          "%s%s  "
          "<b>line</b>=%mS  "
          "<b>via</b>=%mS (%mS)  %s"
          "<b>clearance</b>=%mS  "
          "<b>text</b>=%i%%  "
          "<b>buffer</b>=#%i"),
      Settings.grid_unit->allow,
      Settings.ShowBottomSide ? C_("status", "bottom") : C_("status", "top"),
      PCB->Grid,
      flag, TEST_FLAG (RUBBERBANDFLAG, PCB) ? ",R  " : "  ",
      Settings.LineThickness,
      Settings.ViaThickness,
      Settings.ViaDrillingHole,
      ghidgui->compact_horizontal ? "\n" : "",
      Settings.Keepaway,
      Settings.TextScale, Settings.BufferNumber + 1);

  ghid_status_line_set_text (text);
  g_free (text);
}
Esempio n. 3
0
/* ---------------------------------------------------------------------------
 * sets cursor grid with respect to grid offset values
 */
void
SetGrid (Coord Grid, bool align) {
    char *grid_string;

    if (Grid >= 1 && Grid <= MAX_GRID) {
        if (align) {
            PCB->GridOffsetX = Crosshair.X % Grid;
            PCB->GridOffsetY = Crosshair.Y % Grid;
        }

        PCB->Grid = Grid;
        grid_string = pcb_g_strdup_printf ("%mr", Grid);

        if (grid_string) {
            AttributePut (PCB, "PCB::grid::size", grid_string);
        }

        g_free (grid_string);

        if (Settings.DrawGrid) {
            Redraw ();
        }
    }
}