Esempio n. 1
0
// fill tmp region with new content
// given input index and foreground color
static void render_line(s16 idx, u8 fg) {
  const s16 opIdx = net_in_op_idx(idx);  
  region_fill(lineRegion, 0x0);
  if(opIdx >= 0) {
    // operator input
    // build descriptor string
    clearln();
    appendln_idx_lj(opIdx);
    appendln_char('.');
    appendln( net_op_name(opIdx) );
    appendln_char('/');
    appendln( net_in_name(idx) );
    endln();

    font_string_region_clip(lineRegion, lineBuf, 4, 0, fg, 0);
    clearln();
 
    op_print(lineBuf, net_get_in_value(idx));

    font_string_region_clip(lineRegion, lineBuf, LINE_VAL_POS_SHORT, 0, fg, 0);
  } else {
    // parameter input    
    clearln();
    appendln_idx_lj( (int)net_param_idx(idx)); 
    appendln_char('.');
    appendln( net_in_name(idx)); 
    endln();
    font_string_region_clip(lineRegion, lineBuf, 4, 0, 0xa, 0);
    clearln();

    //    op_print(lineBuf, net_get_in_value(idx));
    /// FIXME: this is pretty dumb, 
    // params and inputs should just be on separate pages i guess
    net_get_param_value_string(lineBuf, idx);

    font_string_region_clip(lineRegion, lineBuf, LINE_VAL_POS_LONG, 0, fg, 0);
  }
  // draw something to indicate play mode visibility
  if(net_get_in_play(idx)) {
    font_string_region_clip(lineRegion, ".", 0, 0, fg, 0);
  }
  // draw something to indicate preset inclusion
  if(net_get_in_preset(idx)) {
    font_string_region_clip(lineRegion, ".", 126, 0, fg, 0);
  }

}
Esempio n. 2
0
// fill tmp region with new content
// given input index
static void render_line(s16 idx, u16 max) {
  region_fill(lineRegion, 0x0);
  if((idx > max) || (idx < 0)) { return; }
  clearln();
  appendln((const char*)files_get_dsp_name(idx));
  endln();
  font_string_region_clip(lineRegion, lineBuf, 0, 0, 0xa, 0);
}
Esempio n. 3
0
// fill tmp region with new content
// given input index and foreground color
static void render_line(s16 idx, u8 fg) {
  region_fill(lineRegion, 0x0);
  if( (idx >= 0) && (idx < maxPresetIdx) ) {
    clearln();
    appendln((const char*)preset_name(idx));
    font_string_region_clip(lineRegion, lineBuf, 2, 0, fg, 0);
  }
}
Esempio n. 4
0
// fill tmp region with new content
// given input index and foreground color
static void render_line(s16 idx, u8 fg) {
  region_fill(lineRegion, 0x0);
  if( (idx >= 0) && (idx < files_get_scene_count()) ) {
    clearln();
    appendln((const char*)files_get_scene_name(idx));
    // stick a null character at the end...
    lineBuf[SCENE_NAME_LEN - 1] = '\0';
    font_string_region_clip(lineRegion, lineBuf, 2, 0, fg, 0);
  }
}
Esempio n. 5
0
// render new operator type name
void render_op_type(void) {
  const char* name = op_registry[userOpTypes[newOpType]].name;
  //  print_dbg("\r\n new op selection: ");
  //  print_dbg(name);
  region_fill(headRegion, 0x0);
  clearln();
  appendln_char('+');
  appendln(name);
  endln();
  font_string_region_clip(headRegion, lineBuf, 0, 0, 0xa, 0);
}
Esempio n. 6
0
// render a given line
void render_line(s16 idx) {

  region_fill(lineRegion, 0x0);
  if((idx >= 0) && (idx < net_num_ops()) ) {
    clearln();
    appendln_idx_lj((u8)idx);
    appendln_char('.');
    appendln(net_op_name(idx));
    endln();
    font_string_region_clip(lineRegion, lineBuf, 0, 0, 0xa, 0);
    // region_fill_part(lineRegion, LINE_UNDERLINE_OFFSET, LINE_UNDERLINE_LEN, 0x1);
  }
}
Esempio n. 7
0
// fill tmp region with new content
// given input index and foreground color
static void render_line(s16 idx, u8 fg) {
    //  const s16 opIdx = net_in_op_idx(idx);
    s16 target;
    s16 targetOpIdx = -1;
    s16 srcOpIdx;
    region_fill(lineRegion, 0x0);

    //  print_dbg("\r\n page_outs: render_line");
    if(idx >= net_num_outs() ) {
        return;
    }
    if(targetSelect) {
        //      print_dbg(" , in targetSelect");
        target = tmpTarget;
    } else {
        target = net_get_target(idx);
    }
    srcOpIdx = net_out_op_idx(idx);
    targetOpIdx = net_in_op_idx(target);

    /* print_dbg(" , target: "); */
    /* print_dbg_ulong(target); */

    if(target >= 0) {
        //// output has target
        // the network doesn't actually execute connections from an op to itself.
        // reflect this in UI by dimming this line
        if(targetOpIdx == srcOpIdx) {
            fg = 0x5;
        }
        // render output
        clearln();
        appendln_idx_lj(srcOpIdx);
        appendln_char('.');
        appendln( net_op_name(srcOpIdx));
        appendln_char('/');
        appendln( net_out_name(idx) );
        endln();
        font_string_region_clip(lineRegion, lineBuf, 2, 0, fg, 0);
        // render target
        targetOpIdx = net_in_op_idx(target);
        clearln();
        appendln("-> ");
        if(targetOpIdx >= 0) {
            //      print_dbg(" , target is op in");
            // target is operator input
            appendln_idx_lj(net_in_op_idx(target));
            appendln_char('.');
            appendln( net_op_name(net_in_op_idx(target)) );
            appendln_char('/');
            appendln( net_in_name(target) );
        } else {
            //      print_dbg(" , target is param in");
            // target is parameter input
            appendln_idx_lj( (int)net_param_idx(target));
            appendln_char('.');
            appendln( net_in_name(target));
        }
        endln();
        font_string_region_clip(lineRegion, lineBuf, 60, 0, fg, 0);
        clearln();
    } else {
        //// no target
        // render output
        clearln();
        appendln_idx_lj(net_out_op_idx(idx));
        appendln_char('.');
        appendln( net_op_name(net_out_op_idx(idx)));
        appendln_char('/');
        appendln( net_out_name(idx) );
        endln();
        font_string_region_clip(lineRegion, lineBuf, 2, 0, fg, 0);
    }
    // draw something to indicate preset inclusion
    if(net_get_out_preset(idx)) {
        font_string_region_clip(lineRegion, ".", 125, 0, fg, 0);
    }
    // underline
    //  region_fill_part(lineRegion, LINE_UNDERLINE_FSET, LINE_UNDERLINE_LEN, 0x1);
}
Esempio n. 8
0
// redraw based on provisional preset seleciton
void redraw_ins_preset ( void ) {
  s32 max = net_num_ins() - 1;
  u8 i=0;
  u8 n = *pageSelect - 3;
  u8 enabled;
  io_t opVal;
  s32 paramVal;
  s16 opIdx;


  print_dbg("\r\n redraw_ins_preset() ");


  while(i<8) {
    region_fill(lineRegion, 0x0);

    opIdx = net_in_op_idx(n);  

    if(n <= max) {
      enabled = net_get_in_preset(n);
      if(opIdx < 0 ) {
	// parameter...
	clearln();
	appendln_idx_lj( (int)net_param_idx(n)); 
	appendln_char('.');
	appendln( net_in_name(n)) ; 
	endln();
	font_string_region_clip(lineRegion, lineBuf, 4, 0, 0xf, 0);
	clearln();

	if(enabled) {
	  paramVal = preset_get_selected()->ins[n].value;
	  net_get_param_value_string_conversion(lineBuf, net_param_idx(n), paramVal);
	} else {
	  net_get_param_value_string(lineBuf, n);
	}
	font_string_region_clip(lineRegion, lineBuf, LINE_VAL_POS_LONG, 0, 0xf, 0);
      } else {
	// op input
	clearln();
	appendln_idx_lj(opIdx);
	appendln_char('.');
	appendln( net_op_name(opIdx) );
	appendln_char('/');
	appendln( net_in_name(n) );
	endln();

	font_string_region_clip(lineRegion, lineBuf, 4, 0, 0xf, 0);

	if(enabled) {
	  opVal = preset_get_selected()->ins[n].value;
	} else {
	  opVal = net_get_in_value(n);
	}
	op_print(lineBuf, opVal);

	font_string_region_clip(lineRegion, lineBuf, LINE_VAL_POS_SHORT, 0, 0xf, 0);
      }
      // draw something to indicate preset inclusion
      if(enabled) {
	font_string_region_clip(lineRegion, ".", 126, 0, 0xf, 0);
      }
    }
    render_to_scroll_line(i, 0);
    ++i;
    ++n;
  }
  //  print_dbg("\r\n\r\n");
  draw_preset_name();
}
Esempio n. 9
0
string initWriter()
{
	string vidmem = (string) 0xb8000;
    char oldmem[strlen(vidmem)];
    strcpy(oldmem, vidmem);

	paintScreen(screen_color);

	drawFrame(header_background, 0, 0, 80, 4);
	printAt("Q OS Text Editor\r\n", header_foreground, 1, 1);
	printAt("Simple Text Editor built for Q OS by Raph Hennessy & Plankp T",desc_foreground,1,2);

	drawBorder(screen_background, 0, 4, 80, sh - 1);

	cursorY = 5;
	cursorX = 1;
	updateCursor();

    bool inCmdMode = true;
    uint16 curX = 1, curY = 5;
    uint32 index = 0;
    strbuilder_t data = strbuilder_init();
    int k;
    while(true)
    {
        cursorX = curX % sw;
        cursorY = curY;
        updateCursor();

        cursorBoundsCheck(&curX, &curY, &index);
        printStatus(curX, curY, inCmdMode);

        if(inCmdMode)
        {
            k = waitUntilKey(7, 0x10 /*Q*/, 0x17 /*I*/, 0x18 /*O*/, 0x3A /*<CAPS>*/, 0x23 /*H*/, 0x26 /*L*/, 0x2D /*X*/);
            switch(k)
            {
            case 0x10:
                goto end;
            case 0x17:
                inCmdMode = false;
                break;
            case 0x18:
                appendln(&data, &curX, &curY, &index);
                inCmdMode = false;
                break;
            case 0x23:
                moveCursorLeft(&curX, &curY, &index);
                break;
            case 0x26:
                moveCursorRight(&curX, &curY, &index);
                break;
            case 0x2D:
                deleteCharAt(&curX, &curY, &index, &data);
                break;
            }
        } else {
            k = getKeycode() / KC_MAGIC_VAL;
            char charInput = ' ';
            switch(k)
            {
            case 0x01:
                inCmdMode = true;
                break;
            case 0x1C:
				cursorBoundsCheck(&curX, &curY, &index);
                appendln(&data, &curX, &curY, &index);
                break;
            case 0x48:
                curY--;
                curX = 1;
				cursorBoundsCheck(&curX, &curY, &index);
                break;
            case 0x4B:
                moveCursorLeft(&curX, &curY, &index);
                break;
            case 0x4D:
                moveCursorRight(&curX, &curY, &index);
                break;
            case 0x50:
                curY++;
                curX = 1;
                cursorBoundsCheck(&curX, &curY, &index);
                break;
            case 0x0E:
                deleteCharAt(&curX, &curY, &index, &data);
                break;
            default:
                if(k < 59 && k > 0)
                {
                    charInput = retCorrespChar(kbShiftChars[k], kbLowerChars[k]);
                    if(charInput == 0)
                    {
                        break;
                    }
                    insertCharAt(&curX, &curY, &index, &data, charInput);
                }
                break;
            }
        }
    }
end: // Sorry for the mom spaghetti code
    // Must be last line (before any prints)
	strcpy(vidmem, oldmem);
    string msg = strbuilder_tostr(data);
    if(msg == NULL)
    {
        msg = "";
    }
    strbuilder_destroy(&data);
    cursorX = 1;
	cursorY = 5;
    print(msg, black);
    return msg;
}
Esempio n. 10
0
// redraw based on provisional preset seleciton
void redraw_outs_preset (void) {
  //  s32 max = net_num_outs() - 1;
  u8 i=0;
  u8 idx = *pageSelect - 3;
  u8 fg;
  u8 enabled;
  s16 target;
  s16 targetOpIdx = -1;
  s16 srcOpIdx; 
  s32 preSel = preset_get_select();
  //  print_dbg("\r\n redraw_outs_preset()");

  while(i<8) {
    region_fill(lineRegion, 0x0);
    if(idx >= net_num_outs() ) { return; }

    enabled = preset_out_enabled(preSel, idx);
    if(enabled) {
      // if it's enabled, show the preset's target (including if blank)
      target = preset_get_selected()->outs[idx].target;
      srcOpIdx = net_out_op_idx(idx);
      targetOpIdx = net_in_op_idx(target);
      if(target >= 0) {
	//// output has target
	// the network doesn't actually execute connections from an op to itself.
	// reflect this in UI by dimming this line
	if(targetOpIdx == srcOpIdx) { fg = 0x5; }
	// render output
	clearln();
	appendln_idx_lj(srcOpIdx);
	appendln_char('.');
	appendln( net_op_name(srcOpIdx));
	appendln_char('/');
	appendln( net_out_name(idx) );
	endln();
	font_string_region_clip(lineRegion, lineBuf, 2, 0, fg, 0);
	// render target
	targetOpIdx = net_in_op_idx(target);
	clearln();
	appendln("-> ");
	if(targetOpIdx >= 0) {
	  // target is operator input
	  appendln_idx_lj(net_in_op_idx(target));
	  appendln_char('.');
	  appendln( net_op_name(net_in_op_idx(target)) );
	  appendln_char('/');
	  appendln( net_in_name(target) );
	} else {
	  // target is parameter input
	  appendln_idx_lj( (int)net_param_idx(target)); 
	  appendln_char('.');
	  appendln( net_in_name(target)); 
	}
	endln();
	font_string_region_clip(lineRegion, lineBuf, 60, 0, fg, 0);
	clearln();
      } else {
	//// no target
	// render output
	clearln();
	appendln_idx_lj(net_out_op_idx(idx));
	appendln_char('.');
	appendln( net_op_name(net_out_op_idx(idx)));
	appendln_char('/');
	appendln( net_out_name(idx) );
	endln();
	font_string_region_clip(lineRegion, lineBuf, 2, 0, fg, 0);
      }
      // draw something to indicate preset inclusion
      if(net_get_out_preset(idx)) {
	font_string_region_clip(lineRegion, ".", 126, 0, fg, 0);
      }
    
    } else {
      // not enabled, draw as normal with dim coloring
      render_line(idx, 0x5);
    }

    render_to_scroll_line(i, 0);
    ++i;
    ++idx;
  }
  draw_preset_name();
}
Esempio n. 11
0
// write to top of line buffer
 inline void println(const char* str, int pos) {
  pline = lineBuf + pos;
  appendln(str);
}